Skip to content

reverseString

文字列を反転します。

この関数は文字列を入力として受け取り、その文字列を反転した形で返します。

インターフェース

typescript
function reverseString(value: string): string;

パラメータ

  • value (string): 反転する文字列。

戻り値

(string): 反転された文字列。

typescript
import { reverseString } from 'es-toolkit/string';

const reversedStr1 = reverseString('hello'); // returns 'olleh'
const reversedStr2 = reverseString('PascalCase'); // returns 'esaClacsaP'
const reversedStr3 = reverseString('foo 😄 bar'); // returns 'rab 😄 oof'

デモ

import "./styles.css";

document.getElementById("app").innerHTML = `
<h1>Hello world</h1>
`;

MIT ライセンスの下で配布されています。