JavaScript Example (Program)
Learn Details

Q. What is the Syntex of Object String Value ?



objectNamae.propertyName

  • Example :

    // ex 1 <script>
    
      var car = {
      type:"Fiat", 
      model:"500", 
      color:"white"
    };
    document.write(car.type +" "+car.model+" "+car.color)
    
       
    </script>
    Out Put : Fiat 500 white

    // ex 2 <script>
    var a ={
    fname : "Rohit",
    lname : "Kumar",
    age : 16,
    Marks : 45.5
    }
    document.write(
    "Name : "+a.fname+" "+a.lname+" <br>"+
    "Age : "+ a.age +" <br>"+
    "Marks : "+ a.Marks +" <br>"
    )
    
       
    </script>
    Out Put : Name : Rohit Kumar
    Age : 16
    Marks : 45.5