meow

mail@pastecode.io avatar
unknown
javascript
a month ago
607 B
31
Indexable
Never
const skaitlis1 = document.getElementById('skaitlis1'); //ievades lauks 1
const skaitlis2 = document.getElementById('skaitlis2'); //ievades lauks 2
const sum = document.getElementById('sum'); //poga


let str = "Number(skaitlis1.value) + Number(skaitlis2.value)"; // savieno abus lmfao
sum.addEventListener('click', () => { // pogas on click
  let output = eval(str);

  if (output > 10) {
    alert(`Lielāks par 10 - ${output} ir tavs skaitlis`)
  } else if (output < 10) {
    alert(`Mazāks par 10 - ${output} ir tavs skaitlis`)
  } else {
    alert(`Vienāds ar 10 - ${output} ir tavs skaitlis`)
  }
})
Leave a Comment