Looping in javascript
Looping in programming languages is a feature that facilitates the execution of a set of instructions/functions repeatedly while some condition evaluates to true.
List of loops in javascript:
Name | Description |
---|---|
Executes code for a specific number of iterations. | |
Repeats code while a condition is true. | |
Repeats code, ensuring at least one execution. |
Syntax:
for (statement 1 ; statement 2 ; statement 3){
code here...
}
Example: Here is the basic example of for loop.
for (let i = 0; i < 5; i++) {
console.log(i);
}
Output
0 1 2 3 4
JavaScript Basics
JavaScript is a versatile, lightweight scripting language widely used in web development. It can be utilized for both client-side and server-side development, making it essential for modern web applications. Known as the scripting language for web pages, JavaScript supports variables, data types, operators, conditional statements, loops, functions, arrays, and objects. With JavaScript, you can create dynamic, interactive, and engaging websites.
These are the basics that you need to learn before deep dive into JavaScript:
Table of Content
- Variables in JavaScript
- Data type in JavaScript
- Conditional statements in javascript
- Function in Javascript
- Looping in javascript
- Comments in javascript
- Operators in javascript
Contact Us