How to use Loops in Javascript?
There are mainly four types of loops in JavaScript. for loop for/in a loop (explained later) while loop do…while loop for loop Syntax: for(statement1; statement2; statment3) { lines of code…
There are mainly four types of loops in JavaScript. for loop for/in a loop (explained later) while loop do…while loop for loop Syntax: for(statement1; statement2; statment3) { lines of code…
Loops are useful when you repeatedly execute the same lines of code a specific number of times or as long as a specific condition is true. Suppose you want to…
For hiding JavaScript codes from old browsers: Add “<!–” without the quotes in the code just after the <script> tag. Add “//–>” without the quotes in the code just before…
Namespacing is used for grouping the desired functions, variables, etc., under a unique name. It is a name that has been attached to the desired functions, objects, and properties. This…
ECMA Script is like rules and guidelines, while Javascript is a scripting language used for web development.
var myArray = ]]; It declares a three-dimensional array.
innerHTML content is refreshed every time and thus is slower. There is no scope for validation in innerHTML. Therefore, it is easier to insert rogue code in the document and…
EncodeURl() is used to convert URL into their hex coding. And DecodeURI() is used to convert the encoded URL back to normal. <script> var uri="my test.asp?name=ståle&car=saab"; document.write(encodeURI(uri)+ "<br>"); document.write(decodeURI(uri)); </script>…
The escape () function is responsible for coding a string to transfer the information from one computer to the other across a network. For Example: <script> document.write(escape("Hello? How are you!"));…
This method is functional at the starting of the array, unlike the push(). It adds the desired number of elements to the top of an array. For example – var…