JavaScript Values and Operators

Start Quiz

Study Flashcards

5 Questions

What symbol is used to represent the remainder operation?

%

What symbol is used to glue two strings together?

What operator can be used to test whether two values are not equal?

!=

What type of value can take on only two possible values, true or false?

Booleans

What is type coercion?

The process of converting a value to the type needed

Study Notes

  • In JavaScript, values of the number type are written as a series of zeros and ones.

  • A computer stores a number as a series of bits, and the number of different numbers that can be represented is limited by the number of bits that are available.

  • To create a value of the number type, you just need to invoke its name.

  • Every value has a type that determines its role in a program.

  • Numbers can be written in decimal or binary form.

  • Computer memory is large enough to store numbers of any size.

  • Numbers of the number type can also store negative values.

  • Nonwhole numbers can be written in decimal or binary form, but they cannot be written as a sum of two whole numbers.

  • Numbers can be represented in JavaScript using the + and * symbols, which are called operators.

  • Arithmetic operations such as addition or multiplication take two number values and produce a new number from them.

  • The + and * symbols have the same precedence, so the order in which they are applied is determined by the precedence of the operators.

  • There is one more arithmetic operator, which you might not immediately recognize. The % symbol is used to represent the remainder operation.

  • Strings are written by enclosing their content in quotes.

  • Almost anything can be put between quotes, and JavaScript will make it a string.

  • Strings are used to represent text.

  • Infinity and -Infinity represent the positive and negative infinities, and NaN stands for “not a number.”

  • Strings are sequences of bits that can be used to store text or other values.

  • A string can be described by a sequence of numbers.

  • The + operator can be used to glue two strings together.

  • The != operator can be used to test whether two values are not equal.

  • The ! operator can be used to test whether a value is not true.

  • The typeof operator can be used to get the type of a value.

  • The != operator can be used to test whether two values are not equal.

  • The ! operator can be used to test whether a value is not true.

  • Boolean values are values that represent only two possibilities, true and false.

  • Booleans are values that can take on one of two possible values, either true or false. - The Boolean operators &&, ||, and not can be used to combine these values into larger boolean expressions. - When comparing Booleans, JavaScript goes from left to right, comparing Unicode code values one by one. - The conditional operator (ternary operator) && can be used to “pick” one of two other values. - The empty value, null, is used to denote the absence of a value. - Type coercion happens when an operator is applied to the wrong type of value, and the value is automatically converted to the type needed.

Test your understanding of JavaScript values, including numbers, strings, booleans, and operators with this quiz. Explore topics such as binary representation, arithmetic operations, string manipulation, comparison operators, type coercion, and more.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser