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

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"); 
} 
主站蜘蛛池模板: 阳东县| 蓬莱市| 绥中县| 朝阳县| 海安县| 牡丹江市| 长兴县| 盐山县| 绩溪县| 宜宾市| 剑阁县| 沙田区| 河西区| 沙田区| 湖口县| 黄冈市| 策勒县| 德惠市| 嘉峪关市| 潜山县| 兴业县| 呼和浩特市| 共和县| 霍城县| 连山| 岳普湖县| 鄂州市| 新宁县| 玉环县| 白城市| 海南省| 和顺县| 彰化县| 尉氏县| 巴彦县| 乐陵市| 永州市| 闸北区| 盈江县| 磴口县| 岗巴县|