- script.js
JavaScript
Result
Goalscompleted
Use the console.log()
command to output the values below to the console and check their types. For each value, enter a command with a new line:
[50, 320, 480]
{meal: 'Breakfast', energy: 50}
Loading…
Everything will be ready in few seconds
On the previous step, you learned about three data types:
number
for numbers,string
for strings, boolean
for logical or boolean values, true or false.In reality, you learned about four data types. Special data type undefined
contains just one value undefined
.
By the way, the number type in JavaScript is intended for integers and non-integer numbers. In other languages, such numbers require different data types.
Let’s now take a look at more complex or compound data types: array and object.
Compound types contain more than one value. The array
array stores the sequence of values , and the order of these values is important. The object
object consists of a multitude of “key-value” pairs, and the order of these pairs is not important. These types of data are recorded as follows:
// Array
[1, 2, 3, 4, 5]
// Object
{month: 'june', day: 15}
// Logs array in the console
console.log([1, 2, 3, 4, 5]);
// Logs array in the console
console.log({month: 'june', day: 15});
We will analyze each of these types of data later, in the courses that are still to come.
Thanks! We’ll fix everything at once!
Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.
Forgot to connect your email to the profile? Email us and we’ll help.
Comments