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 :: play iframe video onclick a link javascript 
Javascript :: scrolling for chatbot 
Javascript :: jquery post failure 
Javascript :: loopback find or create 
Javascript :: javascript remove item from array in loop 
Javascript :: How i can use “LIKE” operator in mongoose 
Javascript :: refreshing a page with jquery 
Javascript :: short date angular pipe 
Javascript :: react native run ios select simulator 
Javascript :: react absolute path 
Javascript :: tailwind css prefix 
Javascript :: #react native shadow 
Javascript :: show 10 entries datatable jquery hide 
Javascript :: rollup is not inlining core-js 
Javascript :: how use for loop in append attribute in jquery 
Javascript :: react start dev server and join with mobile device 
Javascript :: expo textinput caret style 
Javascript :: use history react router dom 
Javascript :: remove value from array javascript 
Javascript :: javascript close current tab 
Javascript :: import json typescript 
Javascript :: ignores _id mongoose schema 
Javascript :: add a text on last object map reactjs 
Javascript :: generate secret key js Java Script 
Javascript :: find array object value is already in use 
Javascript :: multi stage node js dockerfile 
Javascript :: react native shadow generator 
Javascript :: how to close modal using esc key in nuxt js 
Javascript :: change node version nvm mac 
Javascript :: react leaflet marker onclick 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =