JavaScript

settimeout javascript

Click the button to wait 3 seconds, then alert "Hello". settimeout function in javascript <!DOCTYPE html> <html> <body> <p>Click the button to wait 3 seconds, then alert "Hello".</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { setTimeout(function(){ alert("Hello"); }, 3000); } </script> </body> </html>

Read more...

What is Arithmetic operators?

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are an addition (+), subtraction (-), multiplication (*), and division (/). console.log(2 + 3 - 1); // expected output: 4

Read more...

Add Two Numbers with JavaScript

Add Two Numbers with JavaScript Number is a data type in JavaScript which represents numeric data. Now let's try to add two numbers using JavaScript. JavaScript uses the + symbol as an addition operator when placed between two numbers. Example: myVar = 5 + 10; // assigned 15 Change the 0 so that sum will equal 20.

Read more...