Get started with pinyin CDN
Stable version
Copied!
How to start using pinyin CDN
// Include the Pinyin library from the CDN
const Pinyin = require('pinyin/pinyin');
// Function to convert a Chinese character to Pinyin
function getPinyin(chineseCharacter) {
return Pinyin.parse(chineseCharacter)[0].hyphen;
}
// Usage
const chineseCharacter = '中';
const pinyin = getPinyn(chineseCharacter);
console.log(pinyin); // Output: 'zhong'
Copied!
Copied!