Jump to content
  • Sign Up
  • 0

Как прибавить число


sviat78
 Share

Question

Здравствуйте!

 Прошу помощи, моих начальных знаний не достаточно...

 Есть модуль, который вытягивает число с другого сайта:

<div class="lpg-informer-09384">

<script type="text/javascript" src="https://ueex.com.ua/informer_ugd.js?width=300&width_type=px&lang=rus&n=2&encoding=utf&noborder=1¤cy=uah&pluscolor=green&showcurrencies=1"></script>

</div>

<script>
const table = document.querySelectorAll('.lpg-informer-09384 span')
const cost = []
let data = ''

table.forEach((item, index) => {
 if(index === 9) {
  const arr = item.childNodes
  for(let i of arr) {
   cost.push(i)
  }
 }
})

cost.forEach((item, i) => {
 if(i === 0) {
  const str = item.data.slice(0,6)
  data = str
 }
})

window.dataLPGInformer = data


</script>

 

И выводит на сайте:

<div class="lpg-informer-inner-09384">
                 <script>
                   const root = document.querySelector('.lpg-informer-inner-09384')
                   root.innerHTML = `<div class="lpg-informer-price">
                                       <span>
                                         ${window.dataLPGInformer}</a>
                                       </span>
                                     </div>`
                   // document.write(``)
                 </script>
               </div>

Не могу прибавить к этому числу "1000". Выходит как "28 3321000" - то есть 28 332 + 1000 = 28 3321000... А надо 29332...

Заранее благодарен за содействие!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy