in Education by
What is the code to be used to trim whitespaces? (a) let trimmed = (l.trim() for (l in lines)); (b) let trimmed = (trim(l)); (c) let trimmed = l.trim(); (d) let trimmed = for(l in lines)); This question was addressed to me in an interview for job. Query is from Shorthand functions and Multiple catch clauses topic in section Classes and Modules in JavaScript of JavaScript Select the correct answer from above options JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The correct option is (a) let trimmed = (l.trim() for (l in lines)); Best explanation: The various types of trim functions are trimLeft(), trimRight() and trim().can use the above code to trim whitespaces and filter out comments and blank lines.

Related questions

0 votes
    Which of this package is used for analyzing code during run-time? (a) java.applet (b) java.awt ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    JavaScript Code can be called by using ____________ (a) RMI (b) Triggering Event (c) Preprocessor (d) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    JavaScript Code can be called by using ___________ (a) RMI (b) Triggering Event (c) Preprocessor (d) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which character in JavaScript code will be interpreted as XML markup? (a) ! (b) > (c) & (d) ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
0 votes
    When does Exceptions in Java arises in code sequence? (a) Run Time (b) Compilation Time (c) Can ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which part of code gets executed whether exception is caught or not? (a) finally (b) try (c) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which mode allows us to run program interactively while watching source code and variables during execution? (a ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
0 votes
    Java code is embedded under which tag in JSP? (a) Declaration (b) Scriptlet (c) Expression (d) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of the below is a source code management tool? (a) Jenkins (b) Maven (c) Git (d) Hudson ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    What is the code to print hello one second from now? (a) setTimeout(function() { console.log( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
...