- Building Web and Mobile ArcGIS Server Applications with JavaScript(Second Edition)
- Eric Pimpler Mark Lewin
- 137字
- 2021-07-02 15:48:54
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"); }
推薦閱讀
- 從零開始:數(shù)字圖像處理的編程基礎(chǔ)與應(yīng)用
- Oracle Exadata性能優(yōu)化
- Building a RESTful Web Service with Spring
- HTML5+CSS3基礎(chǔ)開發(fā)教程(第2版)
- HTML5 and CSS3 Transition,Transformation,and Animation
- Swift語言實(shí)戰(zhàn)精講
- .NET 4.0面向?qū)ο缶幊搪劊簯?yīng)用篇
- Modular Programming with JavaScript
- 從零開始學(xué)Unity游戲開發(fā):場(chǎng)景+角色+腳本+交互+體驗(yàn)+效果+發(fā)布
- Learning TypeScript
- Python自動(dòng)化開發(fā)實(shí)戰(zhàn)
- Ionic Framework By Example
- R語言數(shù)據(jù)處理及可視化分析
- Multithreading with C# Cookbook(Second Edition)
- Visual FoxPro程序設(shè)計(jì)教程