JavaScript Array: Exercise-24 with Solution
Write a JavaScript function to remove. 'null', '0', '""', 'false', 'undefined' and 'NaN' values from an array.
Sample array: [NaN, 0, 15, false, -22, '',undefined, 47, null]
Expected result:
[15, -22, 47]
Pictorial Presentation:
Sample Solution:
HTML Code:
JavaScript Code:
Sample Output:
[15,-22,47]
Flowchart:
ES6 Version:
Live Demo:
Improve this sample solution and post your code through Disqus
No comments:
Post a Comment