Basic javascript Object


<script type="text/javascript">
var hello={
            say1: 'Hello world.',
            say2: function(){
                return 'I love coffee.';
            },
            say3: function(arg1){
                return 'My name is '+arg1;
            },
            say4: function(){
                return 'First time i said "'+this.say1+'"';
            }
}

// Hello world.
alert(hello.say1);

// I love coffee.
alert(hello.say2());

// my name is Jimi
alert(hello.say3('Jimi'));

//First time i said Hello world.
alert(hello.say4());

// Enjoin your coding ;)
</script>

Comments