日期:2014-05-16 浏览次数:20425 次
function login() { var user = getUserNameFromCookie() for (let i = 0; i < 3; i++) { let pwd = prompt('Please enter your password:') if (securityCheck(user, pwd)) { return true } else { alert('Wrong password! Please try again...') } } return false } if (login()) { alert('Welcome!') } else { alert('Failed to login!') } function securityCheck(user, pwd) { //...do some security checking } function getUserNameFromCookie() { //...read user name from cookie }
function login() { var user = getUserNameFromCookie() for (var i = 0; i < 3; i++) { var temp = prompt('Please enter your password:') with({pwd:temp}) { if (securityCheck(user, pwd)) { return true } else { alert('Wrong password! Please try again...') } } } return false }
function test() { let x = 1 { let f = function(){ this.x = 2 } f() return x } } test()
function test() { with(x:1) { with({f: function(){ this.x = 2 }}) { f() return x } } } test()
function login() { var user = getUserNameFromCookie(); for(var i = 0; i < 3; i ++) { try { throw undefined; } catch(pwd) { pwd = prompt('Please enter your password:'); if(securityCheck(user, pwd)) { return true; } else { alert('Wrong password! Please try again...'); } } } return false; }
statement { ... let n1 = exp1 ... let n2 = exp2 ... let n3 = exp3, n4 = exp4, ... ... }
statement { try { throw undefined } catch (n1) { try { throw undefined } catch (n2) { try { throw undefined } catch (n3) { try { throw undefined } catch (n4) { ... n1 = exp1 ... n2 = exp2 ... n3 = exp3; n4 = exp4; ... }}}} }
var x = 5; var y = 0; let (x = x+10, y = 12) { print(x+y + "\n"); } print((x + y) + "\n");
var x = 5; var y = 0; t