官术网_书友最值得收藏!

Decision support statements

An if/else statement in JavaScript and other programming languages is a control statement that allows for decision-making in your code. This type of statement performs a test based on an expression, that you specify at the top of the statement. If the test returns a value of true then the statements associated with the if block will run. If the test returns a value of false then the execution skips to the first else if block. This pattern continues until a value of true is returned in the test or the execution reaches the else statement. The following code example shows how this statement works:

var layerName = 'streets'; 
if (layerName == 'aerial') { 
    alert("An aerial map"); 
} 
else if (layerName == "hybrid") { 
    alert("A hybrid map"); 
} 
else { 
    alert("A street map"); 
} 
主站蜘蛛池模板: 南皮县| 荆门市| 灵台县| 兴化市| 临汾市| 禹州市| 苏州市| 黔南| 定兴县| 饶阳县| 师宗县| 安达市| 佛教| 丁青县| 大厂| 元朗区| 鄢陵县| 昌吉市| 崇仁县| 鸡东县| 麦盖提县| 海晏县| 涟源市| 历史| 海安县| 沙坪坝区| 久治县| 丹凤县| 瑞安市| 博白县| 江口县| 石家庄市| 乌拉特前旗| 抚顺县| 长泰县| 巴青县| 新竹市| 旬邑县| 咸阳市| 楚雄市| 彝良县|