JavaScript function* expression Last Updated : 07 Aug, 2023 Comments Improve Suggest changes Like Article Like Report The function* is an inbuilt keyword in JavaScript which is used to define a generator function inside an expression. Syntax: function* [name]([param1[, param2[, ..., paramN]]]) { statements}Parameters: This function accepts the following parameter as mentioned above and described below: name: This parameter is the function name.paramN: This parameter is the name of an argument to be passed to the function.statements: These parameters comprise the body of the function.Example 1: Below examples illustrate the function* expression in JavaScript: JavaScript // 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); Output123 - GeeksExample 2: Below examples illustrate the function* expression in JavaScript: JavaScript // Illustration of function* expression // use of function* keyword function* func2(y) { yield y * y; }; function* func1() { for (let i = 1; i < 6; i++) { yield* func2(i); } }; // Function calling for (const x of func1()) { // Output console.log(x); }; Output1 4 9 16 25Supported Browsers: The browsers supported by JavaScript function* expression are listed below: Google Chrome 49 and aboveEdge 12 and aboveFirefox 26 and aboveOpera 36 and aboveSafari 10 and above Comment More infoAdvertise with us Next Article JavaScript function* expression S SHUBHAMSINGH10 Follow Improve Article Tags : JavaScript Web Technologies javascript-basics Similar Reads JavaScript Function Expression A function expression is a way to define a function as part of an expression making it versatile for assigning to variables, passing as arguments, or invoking immediately.Function expressions can be named or anonymous.They are not hoisted, meaning they are accessible only after their definition.Freq 3 min read JavaScript Function Definitions JavaScript functions are declared using the function keyword, either as a declaration or expression. Declarations define named functions, while expressions assign functions to variables. Both enable code reuse and modularity.SyntaxFunction Declarationsfunction functionName( parameters ) { // Stateme 2 min read JavaScript Anonymous Functions An anonymous function is simply a function that does not have a name. Unlike named functions, which are declared with a name for easy reference, anonymous functions are usually created for specific tasks and are often assigned to variables or used as arguments for other functions.In JavaScript, you 3 min read JavaScript Function() Constructor The JavaScript Function() constructor is used to create new function objects dynamically. By using the Function() constructor with the new operator, developers can define functions on the fly, passing the function body as a string. This allows for greater flexibility in situations where functions ne 2 min read Functions in JavaScript Functions in JavaScript are reusable blocks of code designed to perform specific tasks. They allow you to organize, reuse, and modularize code. It can take inputs, perform actions, and return outputs.JavaScriptfunction sum(x, y) { return x + y; } console.log(sum(6, 9)); // output: 15Function Syntax 5 min read Like