- Tags: Conditional
- Categories: JavaScript Reference, JavaScript Resources, Reference
Quick Reference
This is a quick reference list of JavaScript statements with examples of how they are used.
JavaScript – break Statement
The break statement stops code execution within the switch, and also breaks out of a loop, continuing to execute code that comes after the loop.
JavaScript – class Statement
The class statement initiates a class with properties and methods assigned in the constructor() method.
JavaScript – const Statement
The const statement declares a variable (container for storing information) with an immediately defined value that will not change.
JavaScript – continue Statement
The continue statement breaks an iteration in the loop, if a specified condition occurs, and then continues with the next iteration in the loop.
JavaScript – debugger Statement
The debugger statement stops the execution of a script and calls the debugger. If debugging is unavailable, the statement has no effect.
JavaScript – do…while Statement
The do…while statement defines a code block to be executed at least once, and repeated as long as a condition is true.
JavaScript – for Statement
The for statement defines a block of code to be executed as long as a specified condition is true.
JavaScript – for…in Statement
The for…in statement loops over the properties of an object, executing a block of code inside the loop once for each item found.
JavaScript – for…of Statement
The for…of statement loops over the values of any iterable, executing a block of code inside the loop once for each item found.
JavaScript – function Statement
The function statement declares a function to be executed later, when it is called. Functions are objects, and have both properties and methods.
JavaScript – if…else Statement
The if…else statement executes a block of code if a specified condition is true, and optionally, another block of code if false.
JavaScript – let Statement
The let statement declares a variable (container for storing information), and can be empty when declared, with the value assigned later.
JavaScript – switch Statement
The switch statement executes different blocks of code depending on set conditions, and uses the break keyword to break out of the switch block.
JavaScript – throw Statement
The throw statement allows you to generate a custom error (throw an exception), which can be a String, a Number, a Boolean, or an Object.
JavaScript – try…catch…finally Statement
The try…catch…finally statement handles errors without stopping JavaScript to output the error.
JavaScript – var Statement
The var statement declares a variable (container for storing information), and can be empty when declared, with the value assigned later.
JavaScript – while Statement
The while statement defines a code block to be executed for as long as a condition is true.
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.
Why 1SMARTchicken?
See More →
Thanks for your support!
JavaScript Books
All are affiliate links. Thank you for your support!
JAVASCRIPT NOTES:
- When using JavaScript, single or double quotation marks are acceptable and work identically to one another; choose whichever you prefer, and stay consistent
- JavaScript is a case-sensitive language; firstName is NOT the same as firstname
- Arrays count starting from zero NOT one; so item 1 is position [0], item 2 is position [1], and item 3 is position [2] … and so on
- JavaScript variables must begin with a letter, $, or _
- JavaScript variables are case sensitive (x is not the same as X)
Feedback
If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.