Learning JS

by Ronny

JavaScript

// Variables
var Person = function(name, age, address, data){
    this.name = name;
    this.age = age;
    this.address = address;
    
    this.greet = function(target, msg){
        console.log("Hi there,", target, 'I have a message for you:', msg);
    };
}
    
var ronny = new Person('ronny', 24, 'Holon');
var natalie = new Person('natalie', 25, 'Holon');
ronny.greet('Natalie', 'I love YOU');
natalie.greet('Ronny', 'I love you too');

//natalie();
/*
var Ronny = {
    age: 24,
    name: "Ronny Orbach",
    hobbies: ['Music', 'bass'],
    greet: function(name){
        alert('Hello there, ' + name + '!' + ' I am ' + name);
    }
}*/

// Methods
// Arrays
// Objects
// Conditions
// Loops
// windows actions
// Functions