4.
Which method is used to extract a specific section of a string in JavaScript?
slice()
split()
substring()
concat()
Correct: A, C
The slice() method and the substring() method are both used to extract a specific section of a string in JavaScript. Both methods take two parameters: the starting index and the ending index of the section to be extracted. The split() method, on the other hand, is used to split a string into an array of substrings based on a specified delimiter, and the concat() method is used to merge two or more strings together.