A data type provides a set of values from which an expression (i.e. variable, function...) may take its values. 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 type of value from which an expression may take its value.source
In this article, I will describe the types, and in the following we will acquainted with them in more detail.
Тип даних — характеристика, яку явно чи неявно надано об'єкту (змінній, функції, полю запису, константі, масиву тощо). Тип даних визначає множину припустимих значень, формат їхнього збереження, розмір виділеної пам'яті та набір операцій, які можна робити над даними.джерело
У цій статті опишу типи , а у наступних ми мудемо знайомитись з ними детальніше.
Number | Число
//example 1 | приклад 1vari=1000;varpi=3,1415;
The type number is used for both integer and fractional numbers (example 1). This type includes special numerical values of Infinity and NaN.
Тип число використовується як для цілих так і для дробових чисел(приклад 1). Даний тип включає у себе спеціальні числові значення Infinity та NaN.
string | стрічка
//example 2 | приклад 2varname="John",country='Ukraine';
string type to save text information, quotes can be used as single or double. (example 2)
тип стрічка для збереження текстової інформації, лапки можна використовувати як одинарні так і подвійні. (приклад 2)
boolean | Булевий(логічний)
//example 3 | приклад 3varconfirm=true;varconfirm=false;
The logical type stores one of two values true or false .(example 3)
Логічний тип зберігає одне з двох значень true(істина) або false(хибно).(приклад 3)
null | відсутнє значення
//example 4 | приклад 4varcargoCount=null;
null does not refer to any of the types of language. Indicates that value in the variable is "nothing" .(example 4)
null не відносить до жодного з типів мови. Вказує на те що значення у змінної "null" тобто "нічого".(приклад 4)
undefined
//example 5 | приклад 5vara;console.log("SHOW : ",a)// SHOW : undefined
undefined an independent data type as null, consists of one value "undefined" and indicates that the variable is not assigned a value.(example 5)
undefined самостійний тип даних як і null, складається з одного значення "undefined" та вказує на те що змінній не присвоєне значення.(приклад 5)
object | об'єкт
//example 6 | приклад 6varcurrentUser={name:"John",reputation:45}
This type of data is used to build more complex structures and collections.(example 6)
цей тип даних використовується для побудови більш складних структур , та колекцій.(приклад 6)
typeof is an operator that returns a variable type in a text format. In Example 7, as you have noticed, null is defined as an object, but we must remember that null is a self-sufficient data type and it is not an object, also a type of function - in fact it is a type of object, but in practice it is very it's convenient, you will be sure of this in the future.
typeof це оператор який повертає тип змінної у текстовому форматі . У прикладі 7 як ви встигли помітити null визначається як об'єкт , але ми повинні пам'ятати що null самодостатній тип даних і об'єктом він не являється, також тип function - насправді це під тип об'єкту , але на практиці це дуже зручно , ми з вами в цьому впевнимось у подальшому .
In the future, we will consider in more detail each of the types in different articles of this cycle, sure that you will be interesting !!!
У подальшому ми детальніше розглянемо кожен з типів у різних статтях цього циклу, впевнений вам буде цікаво!!!
Дану інформацію ви також знайдете на теренах інтернету.
Інформація буде корисною новачкам.
СТАВТЕ ПАЛЕЦЬ У ВЕРХ!!! ПІДПИСУЙТЕСЬ!!!
КОМЕНТУЙТЕ!!!
You will also find this information on the Internet.
The information will be useful to newcomers.
SUBSCRIBE !!!COMMENT !!!