JavaScript/String

来自康健生活
Kangkk​(留言 | 贡献)2026年11月26日 (四) 07:50的版本 (文字替换 -“{{leftrightflex|”替换为“{{Double-columns|”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

引言

转义

防止被转义。

String.raw`\u00A2`;
'\\u00A2'

排序

const equaldata = [
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/style/foo.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/bar.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/common/qux.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/style/biz.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/fonts/DS-DIGI.ttf',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/bg.png',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/bg2.png'
].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
[
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/bar.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/bg.png',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/bg2.png',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/common/qux.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/fonts/DS-DIGI.ttf',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/style/biz.less',
  '/Users/kangjian/360/dora/td-deadfile/kk/kk-css-exporter/test/resource/style/foo.less'
]

面试题

面试题