Remove empty null undefined values from JavaScript Array
home
Run
screen_rotation
fullscreen
cloud_download
<html> <head> <title>Javascript Demo</title> <script type='text/javascript'> function cleanArray(){ var array = ["Tutorialsplane",null, "0", "1", undefined, "9", "", "03"]; array = array.filter(function(e){return e}); document.getElementById('result').innerHTML = array; } </script> </head> <body> array = ["Tutorialsplane",null, "0", "1", undefined, "9", "", "03"]; <br> <a href="javascript:void(0)" onclick=" cleanArray()">Clean Array-</a><br> Result array = <span id='result'></span> </body> </html>
<html> <head> <title>Javascript Demo</title> <script type='text/javascript'> function cleanArray(){ var array = ["Tutorialsplane",null, "0", "1", undefined, "9", "", "03"]; array = array.filter(function(e){return e}); document.getElementById('result').innerHTML = array; } </script> </head> <body> array = ["Tutorialsplane",null, "0", "1", undefined, "9", "", "03"]; <br> <a href="javascript:void(0)" onclick=" cleanArray()">Clean Array-</a><br> Result array = <span id='result'></span> </body> </html>
Copyrights@tutorialsplane.com