Write a JavaScript function that takes a character as input and returns its UTF-16 code unit value (in decimals) using the relevant method.
Unicode functions
Code unit value in UTF-16
Report a typo
Sample Input 1:
😊Sample Output 1:
55357Write a program in JavaScript
function getCharCode(character) {
// Write your code here
}
/* Do not change code below */
process.stdin.setEncoding('utf8');
process.stdin.on('data', (data) => {
const inputCharacter = data.trim();
const codeUnitValue = getCharCode(inputCharacter);
process.stdout.write(codeUnitValue.toString());
});
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.