How to access Javascript Objects

We can access Javascript object value by either "DOT" notation or "[]" notation

by austinnoronha

HTML

<h3>Test on objects</h3>

<p></p>

JavaScript

var news = {

    eng: "This is English" ,
    hin: "This is Hindi" ,
    mar: "This is Marathi" ,
    kan: "This is Kanada" ,
    tam: "This is Tamil" 

};

$(document).ready(function(){
    var t = function(m){
        return m ? $("p").html( $("p").html() + " <br> ---> " + m) : false;        
    }; 
    
    t(news.eng);
    t(news.hin);
    
    t(news["mar"]);
    t(news['tam']);
    
    t();
    t(null)
    
    t("null band")
});