Block statement
var a = 101 { a = 1; } alert(a) //output 1
Conditional Statements
if...else
Executes a group of statements if a logical condition is true. Use the optional else clause to execute another group of statements.
<!DOCTYPE html> <html lang="en"> <head> <meta charset=utf-8> <title>JavaScript if else statement : Example-1</title> </head> <body> <h1 style="color: red">JavaScript : if else statement</h1> <h3>Here the if else statement check whether the input marks is greater than 50 or not.</h3> <hr /> <form name="form1" action ="#"> Input the marks<input type="text" name="text1" value=" " /> <input type="button" value="Marks check" onclick='marksgrade()' /> </form> <script src="if-else-example1.js"></script> </body> </html>
function marksgrade() { if (document.form1.text1.value>50) alert('Marks is greater than 50.'); else alert('Marks is less than or equal to 50.'); }
switch
Syntax
switch (expression){
case label :
statements;
break;
case label :
statements;
break;
... default : statements;
}
Parameters
expression : Value matched against label.
label : An Identifier to be matched against expression.
statements : Group of statements that are executed once if expression matches label.
<!DOCTYPE html> <html lang="en"> <head> <meta charset=utf-8> <title>JavaScript Switch statement : Example-1</title> <link rel="stylesheet" type="text/css" href="example.css"> </head> <body> <h1>JavaScript : switch statement</h1> <form name="form1" action ="#"> Input Grade type : <input type="text" name="text1" value="A" /> <br /><br /> <input type="button" value="Marks check" onclick='marksgrade()' /> </form> <script src="switch-statement-example1.js"></script> </body> </html>
function marksgrade() { grade = document.form1.text1.value; switch (grade) { case 'A+': alert("Marks >= 90"); break; case 'A': alert("Marks [ >= 80 and <90 ]"); break; case 'B+': alert("Marks [ >= 70 and <80 ]"); break; case 'B': alert("Marks [ >= 60 and <70 ]"); break; case 'C': alert("Marks < 60"); break; default: alert("Wrong grade........."); } }
Loop Statements
do while
while
for
break
continue
Object Manipulation Statements
for ... in
Iterates a specified variable over all the properties of an object
and execute one or more statements for each property of the object.
for (variable in object)
{
statements
}
Variable : Variable to iterate over every property of the object and the variable is accessible outside the loop, after completing the loop.
statements : The statement to be executed for each property of an object. For multiple statements within the loop use a block statement ({..}).
function demo() { var key, str1 = ""; // Initialize object. var student = { name : "David Rayy", classname : "V", rollno : 12 }; // Iterate the properties. for(key in student) { str1 = str1+ student[key]; } return(str1); }
Exception Handling Statement
try...catch...throw
window.onload = function() { var empcode = prompt( "Input the Employee code : (Between 3 to 8 characters):", ""); try { if (empcode.length > 8) { throw "error1"; } else if (empcode.length < 3) { throw "error2"; } } catch (err) { if (err == "error1") { alert("The Employee code length exceed 8 characters."); } if (err == "error2") { alert("The Employee code length is less than 3 characters"); } } }
Other Statements
return expression
The return statement returns a value and exits from the current function.
expression : The expression to return. If not present, function does not return a value.
const
A constant is an identifier for a simple value. The value cannot be modified during the script's execution.
The current implementation of const is a Mozilla-specific extension and is not part of ECMAScript 5.
Syntax
const varname1 = value1 , varname2 = value2,... varnameN = valueN
const height = 400; const width = 200;
相关推荐
2007-02-17 06:44 349,696 w3core.dll 2005-04-04 00:00 83,754 w3core.mfl 2005-04-04 00:00 74,002 w3core.mof 2007-02-17 06:44 39,424 w3dt.dll 2007-02-17 06:50 4,862 w3dt.mfl 2007-02-17 06:44 6,238 w3dt....
w3af REST API w3af的REST API的Docker映像(nginx)受监管。 好处 大多数用户只能从使用./w3af_api ,但高级用户可能需要具有可以处理更多流量的环境,在服务关闭时自动重新启动服务等。 运行此图像 sudo docker ...
2005-4-4 0:00 w3core.mfl 82 KB MFL 文件 2005-4-4 0:00 w3core.mof 73 KB MOF 文件 2005-4-4 0:00 w3dt.dll 39 KB 应用程序扩展 2007-2-17 23:36 w3dt.mfl 5 KB MFL 文件 2005-4-4 0:00 w3dt.mof 7...
w3school.CHM_2009-12-24 23:46 平安夜更新 about ado ado ajax asp aspnet browsers careers css dhtml dotnetmobile dtd e4x example hosting html html5 htmldom i js media msnet php quality quiz rdf rss ...
前端开发手册大全11个(CSS-javascript-jquery-w3c-XHTML-XML).zip CSS参考手册-Web前端开发参考手册系列 Web前端开发规范手册必备 CSS参考手册 javascript参考手册 CSS参考手册 jquery参考手册 XML参考手册 XHTML...
词汇RDF::Vocab::ACL - (W3C) RDF::Vocab::Bibframe -(LoC) RDF::Vocab::CRM - RDF::Vocab::DataCite - RDF::Vocab::DWC -RDF::Vocab::EDM - RDF::Vocab::Fcrepo3 (module) - * RDF::Vocab::Fcrepo4 - RDF::Vocab::...
w3af 网页用户界面介绍该项目为 w3af ( ) 提供 Web 界面,主要构建在: Django ( )。 芹菜 ( ) 对于主存储库可以发现。安装安装所需的依赖项: w3af-控制台MySQL apt-get 安装 python-mysqldb mysql-server-5.1 lxml...
w3af 的飞蛾 一组易受攻击的 PHP 脚本,用于测试 w3af 的漏洞检测功能。 的主要存储库可以在找到。 用法 要使用最简单的方法w3af-moth是开始一个的容器: sudo docker run -p 80:80 -p 2222:22 andresriancho/w3af...
使用包: Emacs-w3m Helm-w3m 安装W3MW3M OS X 使用自制软件安装W3M $brew install w3mUbuntu / Debian的$sudo apt install w3m层$git clone https://github.com/venmos/w3m-layer.git ~ /.emacs.d/private/w3m 要...
JavaScript -> https://www.w3schools.com/js/default.asp 2. HTML -> https://www.w3schools.com/html/ 3. CSS -> https://www.w3schools.com/css/ 后端-> 1. Java -> ...
emacs-w3m:emacs-w3m,一个简单的w3m的Emacs界面
w3c-libwww-5.4.0.7z
苹果丽黑(W3)-Hiragino Sans GB W3
IONIC-W3Schools-Offline-APP 注意:克隆此存储库后。 1.转到项目文件夹,然后浏览www / templates / 2.在文件夹模板内,您将看到zip文件。 3.您要做的是解压缩templates文件夹内的所有文件夹并删除zip文件。 这仅供...
w3af---web应用安全工具
w3c-dom.jar 包 dom解析xml使用 包 免积分下载
SkyTrust JavaScript 元素 SkyTrust 的 JavaScript 元素 入门 确保您安装了最新的软件包 npm install bower install 注意:如果你没有安装npm ,请确保你已经安装了 。 如果你没有凉亭, npm install -g bower 。 ...
W3schoolWeb技术参考手册-JavaScript.chm,内容非常详细!
Learning-Resource-Path-Front-End::high_voltage:这个仓库为开发人员提供了一种资源,可以利用他们的前端开发之旅
lynx的替代品,完美解决LYNX乱码的问题.