+ 1

What will be the content of the paragraph after the user clicks on it twice?

HTML : <p id='txt' onclick='test();'>20</p> JS : <script> function test() { var x=document.getElementById('txt'); var n = x.innerHTML; x.innerHTML = n/2; } </script> Will someone elaborate this to me

13th Jun 2020, 12:35 PM
Lekant T. Shiwankar
Lekant T. Shiwankar - avatar
4 Answers
+ 3
Obviously 20/2 results in 10 on first click ,on second click 10/2 results in 5
13th Jun 2020, 12:38 PM
Abhay
Abhay - avatar
0
function substrNumbrs(first, second) { var result = first - second; result; } document.write(substrNumbrs(10, 5)); can you fun would before return
17th Jun 2020, 9:38 AM
yaswanth
yaswanth - avatar
0
What will be the content of the paragraph after the user clicks on it twice? <p id='txt' onclick='test();'>20</p> <script> function test() { var x=document.getElementById('txt'); var n = x.innerHTML; x.innerHTML = n/2; } </script> _________________________ ANSWER 5
2nd Jul 2020, 7:35 PM
Rustamjon Kosimov
Rustamjon Kosimov - avatar