Skip to content
Related Articles

Related Articles

JavaScript Expressions Complete Reference

Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 23 Nov, 2022
Improve Article
Save Article

JavaScript’s expression is a valid set of literals, variables, operators, and expressions that evaluate a single value that is an expression. This single value can be a number, a string, or a logical value depending on the expression.

Example:

Javascript




<script>
    // Illustration of function* expression
    // use of function* keyword
    function* func() {
      yield 1;
      yield 2;
      yield 3;
      yield " - Geeks";
    }
      
    let obj = '';
      
    // Function calling
    for (const i of func()) {
          obj = obj + i;
    }
  
    // Output
    console.log(obj);
</script>

Output:

123 - Geeks

The Complete List of JavaScript Expressions are listed below:

Primary Expressions

JavaScript Primary Expressions

Description

JavaScript this keyword this keyword in javascript always holds the reference to a single object, that defines the current line of code’s execution context
Async/Await Function in JavaScriptIt simply allows us to write promise-based code as if it was synchronous and it checks that we are not breaking the execution thread.
JavaScript Object initializerThey have properties and methods attached to them and properties are in the form of key-value pairs. 
JavaScript Grouping operatorThe Grouping operator consists of a pair of parentheses around an expression
JavaScript async function expressionAsync function expression is used to define an async function inside an expression in JavaScript. The async function is declared using the async keyword. 
JavaScript Regular ExpressionsA regular expression is a sequence of characters that forms a search pattern. The search pattern can be used for text search and text to replace operations.
JavaScript function* expressionThe function* is an inbuilt keyword in JavaScript which is used to define a generator function inside an expression.
JavaScript Function ExpressionFunction Expression  allows us to create an anonymous function which doesn’t have any function name which is the main difference between Function Expression and Function Declaration
JavaScript class expressionThe class expression is another way of creating classes in JavaScript and they can be named or unnamed. If named, the class name is used internally, but not outside of the class.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!