JavaScript Alert Box

JavaScript Alert Box Alert Box is actually to display a message or value, you can perform arithmetic operation, condition etc, Example1: <!DOCTYPE html> <html> <body> <script> alert(” Welcome to JavaScript”); </script> </body> </html> Output : Welcome to JavaScript Example2: <!DOCTYPE html> <html> <body> <script> var a=10; var b=20; alert(a+b); </script> </body> </html> Output: 30 Exampl3: Continue reading

Airthmetic operator in JavaScript

Airthmetic operator in JavaScript The number which is called operands The operations between two operands are defined by operator Arithmetic operators are • Addition(+) the operations between two or more operands perform an Addition operation ( + ) Example : <!DOCTYPE html> <html> <body> <script>  var a=18;  var b=20;  document.write(a+b); </script> </body> </html> Output: 38 Continue reading

JavaScript Data Types

 JavaScript Data Types 1) String : which are used to store the data that involves the characters Example: var x=” Hello World”; Program: <!DOCTYPE html> <html> <body> <script>  var x=”Hello world”;  document.write(x);  document.write(“<br>”);  document.write(typeof x); </script> </body> </html> Output: Hello world String 2) Numbers : a numbers can be written with or without decimal Example Continue reading