X:\xampp\htdocs\www\uccellani.it\informatica\javascript\js11
Transcript
X:\xampp\htdocs\www\uccellani.it\informatica\javascript\js11
www.uccellani.it 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <html> <head> <title> Esercitazione JavaScript: la funzione isNaN </title> </head> <body> <script type="text/javascript"> <!-var a = 1; var b = parseFloat('7.5 di media'); // restituisce 7.5 var c = parseInt(' 33 trentini'); // restituisce 33 var d = parseFloat('y = 3x - 1'); // restituisce NaN var e = parseInt('euro 10'); // restituisce NaN var f = 0/0; // restituisce NaN document.write(a + ' non è numericamente valido? ' + isNaN(a) '<br />') document.write(b + ' non è numericamente valido? ' + isNaN(b) '<br />') document.write(c + ' non è numericamente valido? ' + isNaN(c) '<br />') document.write(d + ' non è numericamente valido? ' + isNaN(d) '<br />') document.write(e + ' non è numericamente valido? ' + isNaN(e) '<br />') document.write(f + ' non è numericamente valido? ' + isNaN(f) '<br />') //--> </script> </body> </html> js11-funzione isNaN.html prof. Uccellani + + + + + + pagina 1