You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7287f17
Browse filesBrowse the repository at this point in the historyBrowse files
JavaScript strings share many similarities with string implementations from other high-level languages, such as Python's. They represent text based messages and data.
Here we will cover the basics. How to create new strings and perform common operations on them.
4
+
5
+
## Creation
6
+
7
+
```js
8
+
// Single quotes can be used
9
+
var str ='Our lovely string';
10
+
11
+
// Double quotes as well
12
+
var otherStr ="Another nice string";
13
+
```
14
+
15
+
## Concatenation
16
+
17
+
Concatenation involves adding two or more strings together, creating a larger string containing the combined data of those original strings. This is done in JavaScript using the **+** operator.
18
+
19
+
```js
20
+
var bigStr ='Hi '+'JS strings are nice '+'and '+'easy to add';
21
+
```
22
+
23
+
**Note:** Strings can not be substracted, multiplied or divided.
24
+
25
+
## Splitting
26
+
27
+
Splitting a string breaks a string up into an array of smaller strings.
28
+
29
+
```js
30
+
var parts ='We are separated by spaces'.split('');
0 commit comments