Sunday, July 1, 2018

JS: Arrays and Objects

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Arrays</h2>

<p>Arrays use numbers to access its elements.</p>

<p id="demo1"></p>

<p id="demo2"></p>

<script>
var person = ["Shiv in Array", "Doe", 46];      //array
document.getElementById("demo1").innerHTML = person[0];

var man = {firstName:"Ashutosh", lastName:"Doe in Object", age:46};   //object
document.getElementById("demo2").innerHTML = man["firstName"] + " "+man.lastName;  //TWO ways to access object properties
</script>

</body>
</html>

No comments:

Post a Comment

Henry's law constant for CO 2 ​ in water is 1.67×10 ∘ Pa at 298 K . Calculate the quantity of CO 2 ​ in 500 mL , of soda water when packed under 2.5 atm CO 2 ​ pressure at 298 K .

  Explanation To calculate the amount of CO 2 ​ dissolved, we use Henry's Law: P = k H ​ × x _ C O 2 ​ where:\ P = partial pressure of...