zhoukekestar / notes

My Personal Notes.
https://zhoukekestar.github.io/notes/
MIT License
17 stars 8 forks source link

HTML tips #8

Closed zhoukekestar closed 7 years ago

zhoukekestar commented 7 years ago

Maybe this code is better:

var key; // Declare before use it.
key = (key = location.pathname.match(/\/path\/([^\/]*)$/)) && key[1]
zhoukekestar commented 6 years ago

驼峰转连字符

const nameTransformer1 = name => name.replace(/([A-Z])/g,"-$1").toLowerCase();

连字转驼峰

const nameTransformer2 = name => name.replace(/-(\w)/g, (all, letter) => letter.toUpperCase());
zhoukekestar commented 5 years ago

chrome 调试,https://zhoukekestar.github.io/notes/chrome/note/2017/02/13/chrome-note.html

调试临时 vm js 文件: //@ sourceURL=dynamicScript.js, 参考, https://stackoverflow.com/questions/17367560/chrome-development-tool-vm-file-from-javascript