day 1 — jan. 9, 2017

Shanise Barona
my #100daysofcode
Published in
2 min readJan 10, 2017

--

Strings. Interpolations. Concatenate. Template Literals. Boolean.

~Much jargon~

All of this to say, I am learning not only code, but new vocab words as well, haha. Kicked off my first day of the #100 challenge by delving into JavaScript. Here are some things I learned:

Strings. In JavaScript strings are written within quotation marks.

This is a string.
This too is a string.
Yep, you guessed it, another string.

Note the last example uses single quotation marks. Still valid though!

So let’s say,

This is true. 3 + 5 is indeed 8.

The console adds to the two numbers and generates the answer. But if you add quotations around one of the numbers, making it a string, you’ll find that the console generates a different answer.

Uhhh what?!

When you add quotations around the 5 and make it a string, it no longer is simply a number. At this point, you are adding two different data types, a number and a string together with the + operator. JavaScript reconciles the two different data types by pushing together, or concatenating, the number 3 and the string “5” to get “35”.

I’m off to learn more about the many JavaScript data types, hasta mañana.

--

--