Les Types en Javascript
Javascript Types
JS has dynamic types. In JavaScript there are 5 different data types that can contain values:
- string
- number : All numbers in JavaScript are stored as 64-bits Floating point numbers (Floats).
- boolean
- object
- function
There are 3 types of objects:
* Object
* Date
* Array
And 2 data types that cannot contain values:
* null
* undefined
====Objects====
<code>
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue",
car : {color:'blue', weight: 1800}
};
document.getElementById("demo").innerHTML =
person.firstName + " is " + person.age + " years old, his car is " + person.car.color + " and weights " + person.car.weight;
</script>
</body>
</html>
</code>
Commentaires
Enregistrer un commentaire