Category «Javascript»

JavaScript Loops while, for, do while

5.0 01 JavaScript Loops JavaScript loops are used to execute the same code multiple times. They can execute a block of code as long as a specified condition is true.   The While Loop The while loop execute a block of code as long as a specified condition is true. The While loop has the …

JavaScript conditional statements

0.0 00 If statement The if statement is used to specify a block of JavaScript code that is executed, if a condition is true.   Example If You want to execute a single line of code in an if statement, is not necessarily to put curly braces in. However it’s a good practice to always …

Javascript output, alert, console.log, innerHTML

5.0 01 About JavaScript Output JavaScript does not have built-in functions for display, but we are able to display data in different ways: into an alert box, using alert() method which displays an alert box with a specified message;   into the browser console, using console.log(). You may pass as many arguments as you’d like; …

JavaScript operators, arithmetic, unary, string

5.0 01 Assignment operators The assignment operators are used to assign values ​​to variables, like: They Assign the value of the right side of the equal sign to the left of the equal sign. Short form   Long form = x = y x = y += x += y x = x + y …

Javascript variables, rules, examples

5.0 01 In other programming languages when you define a variable, you must specify its type, ie what type of information will be stored in the variable, like integer, boolean, array, etc; JavaScript is different! In JavaScript we create a generic variable and then put whatever type of value we want in it. To create …

About JavaScript code, examples

0.0 00 JavaScript is an interpreted, object-oriented language and is known as the scripting language for web pages. How to add javascript code in HTML? In HTML pages, JavaScript code must be placed between <script> and </script> tags. There are old javascript examples that use “type attribute” inside <script> tag like: The type attribute is …