Skip to main content

Command Palette

Search for a command to run...

JS Functions

Published
1 min readView as Markdown
JS Functions

A set of code that you can use over again, rather than writing it out multiple times.

Syntax :


function functionname (arguments- its optional){
    // code
}

Example:

function number(moon, start){
 console.log(moon + start)
}

number(55, 100)

// here terminal
155

Example:

function eletricals(tv, mobile){
    let total = tv + mobile;
    console.log(total);
}

eletricals(22, 89)


// here terminal 
111

Example:

function fruits ( apple, banana){
    let vegi = apple + banana;
    return  vegi; // through the value
}

let nuts = fruits (80, 24)//catch the value
console.log(nuts);//print the value

// here terminal
104

More from this blog