An Introduction to JavaScript Expressions | CSS-Tricks
Briefly

An Introduction to JavaScript Expressions | CSS-Tricks
"Well, not here-here; technically, I'm over at JavaScript for Everyone to teach you JavaScript. What we have here is a lesson from the JavaScript for Everyon e module on lexical grammar and analysis - the process of parsing the characters that make up a script file and converting it into a sequence of discrete "input elements" (lexical tokens, line ending characters, comments, and whitespace), and how the JavaScript engine interprets those input elements."
"As mental models go, you could do worse than "anywhere in a script that a value is expected you can use an expression, no matter how simple or complex that expression may be:" function numberChecker( checkedNumber ) { if( typeof checkedNumber === "number" ) { console.log( "Yep, that's a number." ); } } numberChecker( 3 ); // result: Yep, that's a number."
Lexical grammar and analysis parse script characters into discrete input elements such as lexical tokens, line endings, comments, and whitespace, which the JavaScript engine then interprets. An expression is code that, when evaluated, resolves to a value; simple arithmetic like 2 + 2 exemplifies this. Anywhere a value is expected, an expression may be used, including literals, computed sums, and function-call results passed as arguments. Practical examples show passing a literal, a computed sum, and complex Math expressions into a function. JavaScript also contains rare exceptions, for example a SyntaxError when a unary operator appears immediately before exponentiation.
Read at CSS-Tricks
Unable to calculate read time
[
|
]