> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/val/prim/str/method/.kebabtocamelcase.md).

# str.kebabToCamelCase()

from kebab case (this-is-kebab-case) to camel case (thisIsCamelCase)

[🔰 JS](/web/js.md) ⟩ [Types](/web/js/val/type.md) ⟩ [String](/web/js/val/prim/str.md) ⟩ [methods](/web/js/val/prim/str/method.md)

{% tabs %}
{% tab title="JS" %}

```javascript

// ⭐️ string.kebabToCamelCase()
// kebab case  | camel case
// aaa-bbb-ccc | aaaBbbCcc
String.prototype.kebabToCamelCase = function() {
    return this
      .split('-')
      .map((str, i) => (i === 0 ? str : str.capitalize()) )
      .join('');
};
```

{% endtab %}

{% tab title="⬆️ 需要" %}

* [String](/web/js/val/prim/str.md) ⟩ [.capitalize()](/web/js/val/prim/str/method/.capitalize.md)
  {% endtab %}

{% tab title="💾 程式" %}

* codepen ⟩ [data attributes](https://codepen.io/lochiwei/pen/MWoMmqZ?editors=0011)
  {% endtab %}

{% tab title="👥 相關" %}

* str.[replace](https://lochiwei.gitbook.io/web/js/val/prim/str/method/pages/Ss1xvk5ReHoT8tTSow70#.replace-regex-replacement)()  ⭐️
  {% endtab %}
  {% endtabs %}
