mdn/js/0_javascript_first_steps/6_useful_string_methods

6_useful_string_methods

dz / mdn / js / 0_javascript_first_steps / 6_useful_string_methods

Summary

Useful String Methods

Node Tree

Nodes

string_methods
content string methods
children slice, startsWith_endsWith, toLowerCase_toUpperCase, includes, indexOf, length, replace

length
content .length(): string length
parents string_methods

includes
content .includes(): contains substring
parents string_methods

startsWith_endsWith
content .startsWith() and .endsWith(): check if string starts/ends with substring
parents string_methods

indexOf
content .indexOf(): find position of substring in string
children indexOf_2ndarg
parents string_methods

indexOf_2ndarg
content Second argument: find index greater, used for subsequent occurances
parents indexOf

toLowerCase_toUpperCase
content .toLowerCase() and .toUpperCase: change case
parents string_methods

slice
content .slice(): extract substring from string. slice(start, end). exclusive.
parents string_methods

replace
content .replace(): replaces one substring with another
parents string_methods