無關鍵字賦值、var宣告、let宣告最大的差別在於生存區域的不同。
無關鍵字賦值 這意味著全域變數的宣告,當然你在全域範圍使用var/let宣告也是全域的。只是無關鍵字可能引發意外的情況,像是你預期變數應該是函數區域的:
function printG(){
g = 1
console.log(`printG: `, g)
}
| let block_keeper = document.querySelector("div.bg\\:white:nth-child(1) > div:nth-child(1) > div:nth-child(1)"); | |
| let video_region = block_keeper.firstChild; | |
| block_keeper.style.height = "400px"; | |
| video_region.style.width = "700px"; | |
| video_region.style.position = "fixed"; | |
| video_region.style.zIndex = 1; |
| ;; -*- mode: emacs-lisp -*- | |
| ;; This file is loaded by Spacemacs at startup. | |
| ;; It must be stored in your home directory. | |
| (defun dotspacemacs/layers () | |
| "Configuration Layers declaration. | |
| You should not put any user code in this function besides modifying the variable | |
| values." | |
| (setq-default | |
| ;; Base distribution to use. This is a layer contained in the directory |
無關鍵字賦值、var宣告、let宣告最大的差別在於生存區域的不同。
無關鍵字賦值 這意味著全域變數的宣告,當然你在全域範圍使用var/let宣告也是全域的。只是無關鍵字可能引發意外的情況,像是你預期變數應該是函數區域的:
function printG(){
g = 1
console.log(`printG: `, g)
}
| call.exec = true; | |
| call.toc = true; | |
| call(callme, 1); | |
| function callme(i) { | |
| if (i < 0) return i; | |
| console.log(i); |
| function wrap(value){ | |
| switch(typeof value){ | |
| case 'number': | |
| return new Number(value) | |
| case 'string': | |
| return new String(value) | |
| case 'boolean': | |
| return new Boolean(value) | |
| case 'symbol': |
| local require = require | |
| local local_conf = require('apisix.core.config_local').local_conf() | |
| local http = require('resty.http') | |
| local core = require('apisix.core') | |
| local log = core.log | |
| local ngx_timer_at = ngx.timer.at | |
| local ngx_timer_every = ngx.timer.every | |
| local debug = require("debug") | |
| local default_weight |