1function myFunc(theObject) {
2 theObject.make = 'Toyota';
3}
4
5var mycar = {make: 'Honda', model: 'Accord', year: 1998};
6var x, y;
7
8x = mycar.make; // x gets the value "Honda"
9
10myFunc(mycar);
11y = mycar.make; // y gets the value "Toyota"
12 // (the make property was changed by the function)
13
1// variable:
2var num1;
3var num2;
4// function:
5function newFunction(num1, num2){
6 return num1 * num2;
7}
1function myFunction(var1, var2) {
2 return var1 * var2;
3}
43
5How to create a function in javascriptJavascript By TechWhizKid on Apr 5 2020
6function addfunc(a, b) {
7 return a + b;
8 // standard long function
9}
10
11addfunc = (a, b) => { return a + b; }
12// cleaner faster way creating functions!