CodeRunBox
Compiler
Glossary
Example
Course
HTML
CSS
JavaScript
Python
Swift
TypeScript
SQL
React
What is JavaScript?-- operator-= operator++ operator+= operatorAccessing and setting contentArray concat() methodArray indexOf()Array lengthArray pop()Array shiftArraysBooleansBracesCallback functionCalling the functionClassClosureCode blockCommentConditionsConsoleConstructorCreating a p elementData typesDate getTime()DestructuringElseElse ifEnumEquals operatorError HandlingES6Event loopEventsExtendFetch APIFilterFor loopforEach()FunctionFunction bind()Function nameGreater thanHead elementHoistingIf statementincludes()Infinity propertyIteratorJSONLess thanLocal storageMapMethodsModuleNumbersObject.keys()Overriding methodsParametersPromisesRandomReduceRegular expressionsRemoving an elementReplaceScopeSession storageSortSpliceStringString concat()String indexOf()SubstringSwitch statementTemplate literalsTernary operatorTileType conversionWhile loop

Code block in JavaScript

if statements don’t decide on skipping or running the entire code. They only make decisions about a piece of code.

This piece of code is called a code block. We write it between curly braces {}.

jsx
if (true) { console.log("I'm a code block!"); }