Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pertemuan 13 JavaScript.

Similar presentations


Presentation on theme: "Pertemuan 13 JavaScript."— Presentation transcript:

1 Pertemuan 13 JavaScript

2 Boolean and Match Object
Boolean Object Match Oject

3 Boolean <html> <body> <script type="text/javascript"> var b1=new Boolean( 0); var b2=new Boolean(1); var b3=new Boolean(""); var b4=new Boolean(null); var b5=new Boolean(NaN); var b6=new Boolean("false"); document.write("0 is boolean "+ b1 +"<br />"); document.write("1 is boolean "+ b2 +"<br />"); document.write("An empty string is boolean "+ b3 + "<br />"); document.write("null is boolean "+ b4+ "<br />"); document.write("NaN is boolean "+ b5 +"<br />"); document.write("The string 'false' is boolean "+ b6 +"<br />"); </script> </body> </html> 0 is boolean false 1 is boolean true An empty string is boolean false null is boolean false NaN is boolean false The string 'false' is boolean true

4 Match Object round() random() max() min()

5 round() <html> <body> <script type="text/javascript"> document.write(Math.round(0.60) + "<br />"); document.write(Math.round(0.50) + "<br />"); document.write(Math.round(0.49) + "<br />"); document.write(Math.round(-4.40) + "<br />"); document.write(Math.round(-4.60)); </script> </body> </html>

6 random() <html> <body> <script type="text/javascript"> document.write(Math.random()); </script> </body> </html>

7 max() <html> <body> <script type="text/javascript"> document.write(Math.max(5,7) + "<br />"); document.write(Math.max(-3,5) + "<br />"); document.write(Math.max(-3,-5) + "<br />"); document.write(Math.max(7.25,7.30)); </script> </body> </html>

8 min() <html> <body> <script type="text/javascript"> document.write(Math.min(5,7) + "<br />"); document.write(Math.min(-3,5) + "<br />"); document.write(Math.min(-3,-5) + "<br />"); document.write(Math.min(7.25,7.30)); </script> </body> </html>

9 Tugas


Download ppt "Pertemuan 13 JavaScript."

Similar presentations


Ads by Google