Flashcards
Variables and Operators
Flashcards do conjunto (13)
- 1Name the three ways to declare a variablevar
let
const - 2Which of the three variable declarations should you avoid and why?var - due to its function scope, which can lead to confusion.
- 3What rules should you follow when naming variables?Use descriptive names in camelCase, avoid reserved words and spaces, maintain consistency, and steer clear of confusing abbreviations.
- 4What happens when you add numbers and strings together?They are concatenated, rather than added
- 5How does the Modulo (%), or Remainder, operator work?Returns the remainder of the division operation
- 6Explain the difference between == and ===== Compares the values
=== Compares values and type - 7When would you receive a NaN result?When you try to do any operation with string other than addition
- 8How do you increment and decrement a number?Using ++ or -- before or after the variable where the number is stored
- 9Explain the difference between prefixing and postfixing increment/decrement operators.The prefix increments the variable first and then performs the operation. Postfixing executes the operator first and then increments the variable.
- 10What is operator precedence and how is it handled in JS?Operator precedence defines the order of evaluation for operators in an expression. Higher precedence operators are evaluated first. For example, in 2 + 3 * 4, multiplication occurs before addition. Parentheses can change this order.
- 11How do you access developer tools and the console?In the browser, right clicking -> inspect -> console or using the shortcut Ctrl + Shift + I
- 12How do you log information to the console?Using the console.log method
- 13What does unary plus operator do to string representations of integers? eg. +”10”Convert string to number
Informações
- Descrição
- Técnico Javascript FlashCards sobre Variables and Operators, criado por Lucas Bastos em 10-10-2024.
- Criado por
- Lucas Bastos
- Visualizações
- 1
- Avaliação