filmov
tv
charCodeAt and codePointAt methods | String Object In JavaScript

Показать описание
🎁 Join my channel to get access to perks:
🧡 Hello All JavaScript Lovers Outhere!
Today you're going to learn about the String Object In JavaScript.
This tutorial is a series of videos, in each video we will discuss a method (or more) of the String Object in JavaScript.
In today's video, you're going to learn about the charCodeAt, and codePointAt methods.
The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index.
The codePointAt() method returns a non-negative integer that is the Unicode code point value at the given position. Note that this function does not give the nth code point in a string, but the code point starting at the specified string index.
🔷 Syntax :
charCodeAt(position)
🔹position : An integer greater than or equal to 0 and less than the length of the string. If index is not a number, it defaults to 0.
🔷 Syntax :
codePointAt(position)
🔹position : Position of an element in str to return the code point value from.
The difference between charCodeAt and codePointAt:
The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index.
The UTF-16 code unit matches the Unicode code point for code points which can be represented in a single UTF-16 code unit. If the Unicode code point cannot be represented in a single UTF-16 code unit (because its value is greater than 0xFFFF) then the code unit returned will be the first part of a surrogate pair for the code point. If you want the entire code point value, use codePointAt().
🌍 Social Media Links.
💲 Suppport the Channel
🧡 Hello All JavaScript Lovers Outhere!
Today you're going to learn about the String Object In JavaScript.
This tutorial is a series of videos, in each video we will discuss a method (or more) of the String Object in JavaScript.
In today's video, you're going to learn about the charCodeAt, and codePointAt methods.
The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index.
The codePointAt() method returns a non-negative integer that is the Unicode code point value at the given position. Note that this function does not give the nth code point in a string, but the code point starting at the specified string index.
🔷 Syntax :
charCodeAt(position)
🔹position : An integer greater than or equal to 0 and less than the length of the string. If index is not a number, it defaults to 0.
🔷 Syntax :
codePointAt(position)
🔹position : Position of an element in str to return the code point value from.
The difference between charCodeAt and codePointAt:
The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index.
The UTF-16 code unit matches the Unicode code point for code points which can be represented in a single UTF-16 code unit. If the Unicode code point cannot be represented in a single UTF-16 code unit (because its value is greater than 0xFFFF) then the code unit returned will be the first part of a surrogate pair for the code point. If you want the entire code point value, use codePointAt().
🌍 Social Media Links.
💲 Suppport the Channel
Комментарии