JavaScript String Methods Explained Simply
- concat() Combines strings
- indexOf() returns index of character
- match() matches based on REGEXP
- slice() Returns a substring based on the “start” and “end” parameters
- split() Splits a string according to the specified delimiter
const enteredTopic = " JavaScript Closures ";
const topic = enteredTopic.trim().toLowerCase();
console.log(topic);
console.log(topic.includes("closures"));
console.log(topic.replace(" ", "-"));
console.log(enteredTopic === " JavaScript Closures "); AI panel
Ask AI to clarify the parts you don’t fully understand, or go more in depth with MDN documentation.