The charCodeAt() ৷ পদ্ধতি প্রদত্ত সূচকে অক্ষরের ইউনিকোড মান নির্দেশ করে একটি সংখ্যা প্রদান করে। ইউনিকোড কোড পয়েন্ট 0 থেকে 1,114,111 পর্যন্ত। প্রথম 128টি ইউনিকোড কোড পয়েন্ট হল ASCII ক্যারেক্টার এনকোডিংয়ের সরাসরি মিল৷
নিম্নলিখিত প্যারামিটারটি charCodeAt(index) -
দ্বারা সমর্থিত- সূচী − স্ট্রিংয়ের দৈর্ঘ্যের চেয়ে 0 এবং 1 কমের মধ্যে একটি পূর্ণসংখ্যা; অনির্দিষ্ট হলে, ডিফল্ট 0.
উদাহরণ
অক্ষরের ইউনিকোড মান নির্দেশ করে এমন একটি সংখ্যা ফেরত দিতে আপনি নিম্নলিখিত কোডটি চালানোর চেষ্টা করতে পারেন −
<html>
<head>
<title>JavaScript String charCodeAt() Method</title>
</head>
<body>
<script>
var str = new String( "This is string" );
document.write("str.charCodeAt(0) is:" + str.charCodeAt(0));
document.write("<br />str.charCodeAt(1) is:" + str.charCodeAt(1));
document.write("<br />str.charCodeAt(2) is:" + str.charCodeAt(2));
document.write("<br />str.charCodeAt(3) is:" + str.charCodeAt(3));
document.write("<br />str.charCodeAt(4) is:" + str.charCodeAt(4));
document.write("<br />str.charCodeAt(5) is:" + str.charCodeAt(5));
</script>
</body>
</html>