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

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"); 
} 
主站蜘蛛池模板: 鹰潭市| 桐庐县| 临安市| 岳池县| 永善县| 右玉县| 崇礼县| 浮梁县| 登封市| 陆丰市| 桑植县| 乐平市| 建湖县| 绥棱县| 柘城县| 冀州市| 准格尔旗| 利津县| 镇宁| 榆林市| 武宣县| 米脂县| 汽车| 临洮县| 鄱阳县| 屏山县| 洛川县| 色达县| 商都县| 聂拉木县| 新丰县| 东丰县| 临颍县| 瓮安县| 章丘市| 沙洋县| 鹤山市| 蓝山县| 天水市| 永城市| 五大连池市|