Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Naming Identifiers | JavaScript syntax
Introduction to JavaScript (staging)
course content

Зміст курсу

Introduction to JavaScript (staging)

Introduction to JavaScript (staging)

1. Introduction
2. JavaScript syntax
3. Data Types and Variables

Naming Identifiers

Good practices for naming identifier

  • Though you can name identifiers in any way you want, it’s a good practice to give a descriptive identifier name.
  • Names should be logical.
  • If you are using an identifier for a variable to store the number of students, it is better to use students, numberOfStudents, or number_of_students rather than x or n.
1234567891011
//valid but not preferable let n = 10; console.log(n); // clear and descriptive name let numberOfStudents = 10; console.log(numberOfStudents); //clear and descriptive name let number_of_students = 10; console.log(number_of_students);
copy

In both cases, the output is the same but the second and the third identifiers are more meaningful.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Summary

  • Identifiers are names for the variables, arrays, functions, objects, and classes.
  • The identifier should follow the above rule.
  • Identifiers should have descriptive names.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 5
toggle bottom row

Naming Identifiers

Good practices for naming identifier

  • Though you can name identifiers in any way you want, it’s a good practice to give a descriptive identifier name.
  • Names should be logical.
  • If you are using an identifier for a variable to store the number of students, it is better to use students, numberOfStudents, or number_of_students rather than x or n.
1234567891011
//valid but not preferable let n = 10; console.log(n); // clear and descriptive name let numberOfStudents = 10; console.log(numberOfStudents); //clear and descriptive name let number_of_students = 10; console.log(number_of_students);
copy

In both cases, the output is the same but the second and the third identifiers are more meaningful.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Summary

  • Identifiers are names for the variables, arrays, functions, objects, and classes.
  • The identifier should follow the above rule.
  • Identifiers should have descriptive names.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 5
toggle bottom row

Naming Identifiers

Good practices for naming identifier

  • Though you can name identifiers in any way you want, it’s a good practice to give a descriptive identifier name.
  • Names should be logical.
  • If you are using an identifier for a variable to store the number of students, it is better to use students, numberOfStudents, or number_of_students rather than x or n.
1234567891011
//valid but not preferable let n = 10; console.log(n); // clear and descriptive name let numberOfStudents = 10; console.log(numberOfStudents); //clear and descriptive name let number_of_students = 10; console.log(number_of_students);
copy

In both cases, the output is the same but the second and the third identifiers are more meaningful.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Summary

  • Identifiers are names for the variables, arrays, functions, objects, and classes.
  • The identifier should follow the above rule.
  • Identifiers should have descriptive names.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Good practices for naming identifier

  • Though you can name identifiers in any way you want, it’s a good practice to give a descriptive identifier name.
  • Names should be logical.
  • If you are using an identifier for a variable to store the number of students, it is better to use students, numberOfStudents, or number_of_students rather than x or n.
1234567891011
//valid but not preferable let n = 10; console.log(n); // clear and descriptive name let numberOfStudents = 10; console.log(numberOfStudents); //clear and descriptive name let number_of_students = 10; console.log(number_of_students);
copy

In both cases, the output is the same but the second and the third identifiers are more meaningful.

Завдання

Declare a variable, using the const keyword, with the identifier numberOfEmployees and assign the value 50 to that variable and print the value of the variable on the console using the console.log() function.

Summary

  • Identifiers are names for the variables, arrays, functions, objects, and classes.
  • The identifier should follow the above rule.
  • Identifiers should have descriptive names.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 2. Розділ 5
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt