FCC-学习笔记 Spinal Tap Case 1>最近在学习和练习FCC的题目.这个真的比较的好,推荐给大家. 2>中文版的地址:https://www.freecodecamp.cn/;英文版的地址:https://www.freecodecamp.org 3>这次写关于一个JS的问题,名为Spinal Tap Case. 规则要求如下: 将字符串转换为 spinal case.Spinal case 是 all-lowercase-words-joined-by-dashes…
function spinalCase(str) { // "It's such a fine line between stupid, and clever." // --David St. Hubbins str = str.replace(/_/g," ") .replace(/([A-Z])/g," $1") .replace(/^\s/,"") .replace(/\s+/g,"-") .toLo…