1.

Can we add one or more element to the front of an array in JavaScript?

Answer»

NaN SUGGESTS that the entered VALUE is not a legal number. It is a JavaScript property, which can also be considered as a "Not-a-Number" value.

To determine the entered value is a number or not, you can use the Number.isNaN() method. If the result is “True”, then it would that the given value is not a number, whereas “FALSE” would mean the value is a legal Number.

Let US see an example:

<!DOCTYPE html> <html> <body> <script>     var a = "Grill";     document.write(isNaN(a)); </script> </body> </html>

The OUTPUT displays True since the above value is not a legal number: 

True

Let us see another example: 

<!DOCTYPE html> <html> <body> <script>     var a = 10;     document.write(isNaN(a)); </script> </body> </html>

The output since the above value is a legal number: 

False

Let us see another example: 

<!DOCTYPE html> <html> <body> <script>     var a = 0/0;     document.write(isNaN(a)); </script> </body> </html>

The output generates True since 0/0 is not a legal number: 

True


Discussion

No Comment Found