Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Function In JavaScript

/*A function statement starts with the function keyword. 
It can return a primitive type value, object, or another function.
For example, a function statement can return an object as shown in the following code example:*/
function getProduct(){
    let product = {
        Id:1,
        Title:'Book',
        Price: 30
    };
    return product; 
}

let p1 = getProduct();
console.log(p1); // prints product object 
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Function #In #JavaScript
ADD COMMENT
Topic
Name
1+8 =