https://www.w3schools.com/js/tryit.asp?filename=tryjs_numbers_divide_string
' Un numero diviso per una stringa non numerica diventa NaN (Not a Number): <!DOCTYPE html> <html> <body> <h2>JavaScript Numbers</h2> <p>A number divided by a non-numeric string becomes NaN (Not a Number):</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = 100 / "Apple"; </script> </body> </html> ' Oppure IsNaN https://www.w3schools.com/js/tryit.asp?filename=tryjs_numbers_isnan_true ' Puoi utilizzare la funzione JavaScript globale isNaN () per scoprire se un valore e' un numero: ' vero <!DOCTYPE html> <html> <body> <h2>JavaScript Numbers</h2> <p>You can use the global JavaScript function isNaN() to find out if a value is a number:</p> <p id="demo"></p> <script> var x = 100 / "Apple"; document.getElementById("demo").innerHTML = isNaN(x); </script> </body> </html> |