📚 › JavaScript: make pages do things
7. Functions
इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।
A function is a named block of code you can run many times. Write it with the word function, a name, parameters in brackets and the code in braces. return sends a value back.
Functions let you write logic once and reuse it everywhere.
उदाहरण देखें
function greet(name) {
return "Hello, " + name;
}
console.log(greet("Ayesha"));
✍️ अब आपकी बारी
Write double(x) that returns x times 2, then print double(21).