0
About Data Types
Can you please say more about Data Types with examples . ?
3 Antworten
+ 6
https://www.sololearn.com/learn/JavaScript/1129/?ref=app
Nafew Ahmed
other Links
•https://www.tutorialrepublic.com/javascript-tutorial/javascript-data-types.php
•https://www.w3schools.com/js/js_datatypes.asp
•https://javascript.info/types
•https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
+ 1
In computer science and computer programming, a data type or simply type is an attribute of data that tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers (of varying sizes), floating-point numbers (which approximate real numbers), characters, and Booleans. A data type constrains the values that expression, such as a variable or a function, might take. This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored. A data type provides a set of values from which an expression (i.e. variable, function, etc.) may take its values.
There are six basic data types in JavaScript which can be divided into three main categories: primitive (or primary), composite (or reference), and special data types. String, Number, and Boolean are primitive data types. Object, Array, and Function (which are all types of objects) are composite data types. Whereas Undefined and Null are special data types. These are:
1. The String Data Type: var a = 'Hi there!';
2. The Number Data Type: var c = 4.25e+6;
3. The Boolean Data Type: var isReading = true;
4. The Undefined Data Type:
var a;
var b = "Hello World!"
alert(a) // Output: undefined
alert(b) // Output: Hello World!
5. The Null Data Type:
var a = null;
alert(a); // Output: null
6. The Object Data Type:
var emptyObject = {};
var person = {"name": "Clark", "surname": "Kent", "age": "36"};
// For better reading
var car = {
"modal": "BMW X3",
"color": "white",
"doors": 5
}
7. The Array Data Type:
var colors = ["Red", "Yellow", "Green", "Orange"];
alert(colors[0]);
8. The Function Data Type:
var greeting = function(){
return "Hello World!";
}
alert(greeting());
9. The typeof Operator: typeof 15;
Thanks...
+ 1
Thank you so much