A string is anything enclosed within quote marks – it can be made up of letters, numbers, and/or symbols. Strings will work with either single or double quotes.

[js]
“hello world”;
‘I have 5 pears’;
[/js]

When creating strings, there are often times when you will want to join one or more strings together. This is call concatenation, and is used by adding a “+” (plus sign) in between the strings you want to join together.

[js]
“hello” + “world”;
[/js]

Categories: BasicsJavaScript/Ajax

0 thoughts on “JavaScript Basics Part 3: Strings”

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Basics

JavaScript Basics Part 7: Loops

Loops are used to execute the same statement of code a set number of times, which can be hardcoded or based on variable. Loops are very common within programming, as they solve the problem of Read more…

Basics

JavaScript Basics Part 6: Conditionals

Logic is a part of our everyday lives – it’s a very familiar concept, therefore one of the easiest to understand. We are faced with questions all the time, with the “If” question being the Read more…

Basics

JavaScript Basics Part 5: Arrays

An array is a variable which can store many values inside it. A variable can only store one value. Those values can be accessed at any time using the array’s index. The values stored within Read more…