Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Statements and Expressions in JS

// Statements
let x = 0;
function add(a, b) { return a + b; }
if (true) { console.log('Hi'); }

// Expressions
x;          // Resolves to 0
3 + x;      // Resolves to 3
add(1, 2);  // Resolves to 3
Comment

statement and expression in js

//statement
A statement is an instruction to perform a specific action. Such actions include creating a variable or a function, looping through an array of elements, evaluating code based on a specific condition etc. JavaScript programs are actually a sequence of statements.
//expression
Any unit of code that can be evaluated to a value is an expression. Since expressions produce values, they can appear anywhere in a program where JavaScript expects a value such as the arguments of a function invocation.
Comment

PREVIOUS NEXT
Code Example
Javascript :: accept Post with no midleWare express 
Javascript :: Too long with no output (exceeded 10m0s): context deadline exceeded 
Javascript :: js get form inputs 
Javascript :: npm numeral 
Javascript :: javascript blob to file 
Javascript :: retrieve data from option select js 
Javascript :: img src in react js 
Javascript :: how to disable keyboard input in javascript 
Javascript :: Creating a Node.js MySQL Database 
Javascript :: merge objects javascript 
Javascript :: get params from route vuejs 
Javascript :: import modules js html 
Javascript :: javascript date convert to unix 
Javascript :: basic express graphql 
Javascript :: how to create an array in node js 
Javascript :: npm react pagination 
Javascript :: round js 
Javascript :: first repeated character in a string javascript 
Javascript :: get value from json object in javascript 
Javascript :: javascript enable clipboard 
Javascript :: javascript test if string starts with alphabet 
Javascript :: Uncaught TypeError: Object prototype may only be an Object or null: undefined 
Javascript :: toggle class jquery not working 
Javascript :: jquery div show 
Javascript :: json limit express 
Javascript :: js string to json 
Javascript :: Javascript console log a string 
Javascript :: date range filter 
Javascript :: import img react in another file 
Javascript :: how to get text from input js 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =