xxxxxxxxxx
const myFunction = () => {
console.log("code goes here")
}
xxxxxxxxxx
function MyFunction() {
console.log('Hello World')
//Text On Console
}
MyFunction()
//Running Function
xxxxxxxxxx
function doSomething()
{
var x;
x = 10;
y = 20;
alert('x = ' + x);
alert('y = ' + y);
}
xxxxxxxxxx
the function of javascript is to teach first year programers
synactically correct language constructs by way of an anti-pattern.
xxxxxxxxxx
var x = myFunction(10, 10); // Function is called, return value will end up in x
function myFunction(a, b) {
return a * b; // Function returns the product of a and b
}
xxxxxxxxxx
function walkTree(node) {
if (node === null) {
return;
}
// do something with node
for (let i = 0; i < node.childNodes.length; i++) {
walkTree(node.childNodes[i]);
}
}
xxxxxxxxxx
function sayHelloTo(to) {
alert(`Hello ${to}`);
}
sayHelloTo('World from Grepper')
xxxxxxxxxx
function multiply(num1,num2) {
let result = num1 * num2;
return result;
}