ibvasi
5/12/2017 - 6:28 AM

Functions

Functions

function greet() {
    console.log("hi");
}
greet(); // hi
greet.hi = "How are you";
console.log(greet.hi); // "How are you"

var family = {};
function totalFamily(familyOne) {
    var two = familyOne;
    var one = family[two];
    console.log(two);
}
totalFamily(123); // 123

function names() {
    for (var i = 0; i < arguments.length; i++) {
        console.log(i);
        console.log(arguments[i]);
        console.log(arguments)
  }
}
names("John", "Miller");
// 0 1
// {0: "John", 1:"Miller"} {0: "John, 1:"Miller"}
// John Miller

var familyTwo = {
    name: "John"
};
function familythree(familyTwo) {
    var one = familytwo;
    console.log(one);
}
familyThree(familyTwo); // {name: "John"}