-
Notifications
You must be signed in to change notification settings - Fork 2
JS Block
In computer programming, a block or code block is a section of code which is grouped together. Blocks consist of one or more declarations and statements. A programming language that permits the creation of blocks, including blocks nested within other blocks, is called a block-structured programming language. JavaScript is one such programming language.
A block statement in JavaScript is used to group zero or more statements. The block is delimited by a pair of curly brackets.
{
statement_1;
statement_2;
...
statement_n;
}
The block statement is commonly used with control flow statements (e.g. if...else
, for
, while
) and functions.
while (x < 10) {
x++;
}
function addnums(num1, num2) {
var sum = 0;
sum = num1 + num2;
return sum;
}
Learn to code and help nonprofits. Join our open source community in 15 seconds at http://freecodecamp.com
Follow our Medium blog
Follow Quincy on Quora
Follow us on Twitter
Like us on Facebook
And be sure to click the "Star" button in the upper right of this page.
New to Free Code Camp?
JS Concepts
JS Language Reference
- arguments
- Array.prototype.filter
- Array.prototype.indexOf
- Array.prototype.map
- Array.prototype.pop
- Array.prototype.push
- Array.prototype.shift
- Array.prototype.slice
- Array.prototype.some
- Array.prototype.toString
- Boolean
- for loop
- for..in loop
- for..of loop
- String.prototype.split
- String.prototype.toLowerCase
- String.prototype.toUpperCase
- undefined
Other Links