JavaScript/String

来自康健生活

引言

转义

防止被转义。

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'
]

面试题

面试题