Flowchart
Strings data type overview
Flowchart content
JavaScript String Type
Strings Data Type
Dealing with text. Is a symbol of characters united together to display a unified message that is readable not only from computers but also from users.
You create a string with 2 possible ways and the difference is on the quotes:
let sentence = 'This is a string literal' // This is called a string literal
let anotherSentence = `This is an interpolated string` // string interpolation
The main difference is that interpolated strings can contain javascript expressions inside (like variables, executable functions and many many more), while in order to achieve the same result with string literals you need to concatenate the expressions to the existing string.
ex. let name = 'Jake';
let sayYourName = 'Hello, my name is ' + name;
let sayYourNameInterpolated = `Hello, my name is ${name}`
Strings have methods in order to be manipulated and changes. Some of the most used ones are:
string.length // Returns the exact length of the specified string
string.split(' ') // Splits an existing string into array elements. You can specify every when is splited
string[0] // Grab the first character of a string. Or grab in general by index.
string. replace('someword', 'anotherword') // Replace all instances of the first argument with the second
You can find out whole String documentation here!
Information
- Description
- Junior Certificate Web Developing (JavaScript) Flowchart on Strings data type overview, created by Kostas Diakogiannis on 12/10/2018.
- Created by
- Kostas Diakogiannis
- Views
- 9
- Rating