How to convert a camel-case string to dashes in JavaScript?

前端 未结 7 1276
情深已故
情深已故 2021-02-13 02:22

I want to convert these strings:

fooBar
FooBar

into:

foo-bar
-foo-bar

How would I do this in JavaScript the m

相关标签:
7条回答
  • 2021-02-13 03:25

    Maybe you could use kebabCase from lodash: https://lodash.com/docs/4.17.15#kebabCase

    0 讨论(0)
提交回复
热议问题