Vidyalelo
JavaScript · Q61

Classes And Modules

Programming · JavaScript · question 61

Q61

What is the code to be used to trim whitespaces ?

A.
let trimmed = (l.trim() for (l in lines));
Answer
B.
let trimmed = (trim(l));
C.
let trimmed = l.trim();
D.
let trimmed = for(l in lines));

Answer: Option A

Solution

Answer: Option A
Solution:
We can use the above code to trim whitespaces and filter out comments and blank lines.