1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

add extend

This commit is contained in:
程序员小墨 2022-12-09 00:10:49 +08:00
parent 88dea913c3
commit d9508f34d5
5 changed files with 3177 additions and 3 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,33 @@
/**
* javascript 输出所有汉字
* refer: https://zhidao.baidu.com/question/1641830754970388060.html
*/
/*
汉字范围
\u4E00-\u9FA5
*/
// 分析
// unescape("%u4E00") // "一"
// parseInt("4E00", 16) // 19968
// parseInt('9FA5', 16) // 40869
// (19968).toString(16) // "4e00"
// 实现
function printChar() {
let a = []
var start = 19968;
var end = 40869;
var maxCount = end - start;
function transform(n) {
return unescape("%u" + n.toString(16));
}
function print(data) {
// console.log(data);
a.push(data)
}
for (var n = 0; n < maxCount; n++) {
print(transform(start + n));
}
console.log(a.join(''))
}
printChar();