Tutorial Details
- Judul: Javascript Statment Condition
- Difficulty: Beginner
- Platform:-
- Bahasa Scripth: Javascript
- Software : Notepad ++
- Estimated Completion Time: 15 minutes
- Created:Ricko Nada (Pustaka Flash)
1.if...else
live demo :Di browser
Scripth yang digunakan :
var a = 5;
var b = 3;
if (a < b){
document.write(a+" is less than "+b);
} else if (a > b){
document.write(a+" is greater than "+b);
} else {
document.write(a+" must therefore be equal to "+b);
}
2.switch...break
live demo :Di browser
var country = "USA";
switch (country) {
case "UK":
document.write("UK citizens are known for being drunk.");
break;
case "USA":
document.write("USA citizens are known for being dumb.");
break;
default:
document.write("No match for value: "+country);
}
5 Halaman yang sering dikunjungi:
0 komentar:
Post a Comment