# Strings and numbers equality in JavaScript

As you know, a number in quotes is a string. For example, `'3'` is a string. However, when comparing such strings with real numbers, JavaScript considers the quoted string to be equal to the same number.

For example, let's compare the string `'3'` and the number `3`:

`if ('3' == 3) { console.log('+++'); // it will work } else { console.log('---'); }`

Given variables:

`let test1 = '123'; let test2 = 123;`

Check if the values of the variables are equal and display the appropriate message.

←→
↑
en ru