This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 回形矩阵 | |
* @param {Number} n - 矩阵尺寸 | |
* @return {String} | |
*/ | |
function spiralMatrix (n) { | |
let matrix = []; | |
let a = n ** 2; | |
let p = a.toString().length; | |
for (let x = 0; x < n; x++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Promises/A+ | |
* @see http://www.ituring.com.cn/article/66566 | |
* @param {Function} executor | |
*/ | |
function MyPromise (executor) { | |
let PromiseStatus = "pending"; | |
let PromiseValue = undefined; | |
let PromiseTasks = []; |