fix: use const to declare variables in js
This commit is contained in:
		| @@ -16,13 +16,13 @@ stack.push(5); | |||||||
| stack.push(4); | stack.push(4); | ||||||
|  |  | ||||||
| /* 访问栈顶元素 */ | /* 访问栈顶元素 */ | ||||||
| peek = stack[stack.length - 1]; | const peek = stack[stack.length - 1]; | ||||||
|  |  | ||||||
| /* 元素出栈 */ | /* 元素出栈 */ | ||||||
| pop = stack.pop(); | const pop = stack.pop(); | ||||||
|  |  | ||||||
| /* 获取栈的长度 */ | /* 获取栈的长度 */ | ||||||
| size = stack.length; | const size = stack.length; | ||||||
|  |  | ||||||
| /* 判断是否为空 */ | /* 判断是否为空 */ | ||||||
| is_empty = stack.length === 0; | const is_empty = stack.length === 0; | ||||||
|   | |||||||
| @@ -155,16 +155,16 @@ comments: true | |||||||
|     stack.push(4); |     stack.push(4); | ||||||
|  |  | ||||||
|     /* 访问栈顶元素 */ |     /* 访问栈顶元素 */ | ||||||
|     peek = stack[stack.length-1]; |     const peek = stack[stack.length-1]; | ||||||
|  |  | ||||||
|     /* 元素出栈 */ |     /* 元素出栈 */ | ||||||
|     pop = stack.pop(); |     const pop = stack.pop(); | ||||||
|  |  | ||||||
|     /* 获取栈的长度 */ |     /* 获取栈的长度 */ | ||||||
|     size = stack.length; |     const size = stack.length; | ||||||
|  |  | ||||||
|     /* 判断是否为空 */ |     /* 判断是否为空 */ | ||||||
|     is_empty = stack.length === 0; |     const is_empty = stack.length === 0; | ||||||
|     ``` |     ``` | ||||||
|  |  | ||||||
| === "TypeScript" | === "TypeScript" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user