45 string literals in JS - Javascript tutorial 2018

preview_player
Показать описание
The Full #Javascript #tutorial for #beginners :

Learn HTML, CSS and JavaScript

Javascript Tutorial 2018

45 string literals - JavaScript for Beginners.

This is a Javascript tutorial from scratch for any beginner. Use the above link to watch the full JS video tutorial..

Hey, and welcome back.

In the last video we looked at floating-point literals.

In this video let's look at string literals.

What is a string? A string refers to zero or more characters enclosed in double or single quotes.

So you can see, this is a number.

But since you've enclosed it in double quotes, it becomes a string.

This is also a string.

That's a string, a string.

So you can use either the double quotes or single quotes to enclose your strings.

In JavaScript you can represent statements, maybe things that was said, maybe it is a name or it's a statement, a sentence, a paragraph.

You can represent that using a string.

So such kind of data will be represented as strings in JavaScript.

Basically, any characters that is enclosed within the double or single quotes, those will be treated as strings in JavaScript.

So if you're doing some kind of an arithmetic operation and you use this string, something might go wrong.

For instance, let's say you want to add two numbers and they’re being treated as strings.

‘2’+’2’.

And we saw this very early on and we said that this will lead to what is called a concatenation.

So, this will give you 22.

If you did something like this and you're doing an addition, then it will be treated as a join which we call concatenation.

So to concatenate, basically to join.

So the idea is to know that any characters that you enclose within the double or the single quotes will be treated as strings.

So let's continue in the next video where we’ll continue to look at more elaborate things about the strings and string literals.

See you then.

GET SOCIAL WITH ME:
Рекомендации по теме