function js

Solutions on MaxInterview for function js by the best coders in the world

showing results for - "function js"
Greta
08 May 2020
1var x = myFunction(4, 3);     // Function is called, return value will end up in x
2
3function myFunction(a, b) {
4    return a * b;             // Function returns the product of a and b
5}
Davide
28 Jan 2017
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
Marco
25 Apr 2019
1// variable:
2var num1;
3var num2;
4// function:
5function newFunction(num1, num2){
6	return num1 * num2;
7}
Marin
30 Feb 2019
1function myFunction(){
2  document.write("Hello World!")
3}
4myFunction();
Maximiliano
17 Sep 2017
1function myFunc(param) {
2  return param
3}
4console.log(myFunc("Hello World"))
Edoardo
05 Oct 2017
1function toCelsius(fahrenheit) {
2  return (5/9) * (fahrenheit-32);
3}