Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js string to bytes

function strToUtf16Bytes(str) {
  const bytes = [];
  for (ii = 0; ii < str.length; ii++) {
    const code = str.charCodeAt(ii); // x00-xFFFF
    bytes.push(code & 255, code >> 8); // low, high
  }
  return bytes;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery populate select from json 
Javascript :: javascript is variable a string 
Javascript :: javascript loop over class 
Javascript :: javascript filter strings for partial matches 
Javascript :: js scrollto 
Javascript :: Finding the array element: 
Javascript :: express messages 
Javascript :: react create root 
Javascript :: javascript replace string 
Javascript :: form confirm before submit 
Javascript :: how to get url query string value in javascript 
Javascript :: windows.load with settimeout 
Javascript :: get id button clicked react 
Javascript :: datatable set placeholder 
Javascript :: jquery delay to call function 
Javascript :: javascript get all keys of object 
Javascript :: javascript letters as number 
Javascript :: mongoose connect url 
Javascript :: split string into equal chunks javascript 
Javascript :: how to import all material module in angular 
Javascript :: javascript alphabet to number 
Javascript :: hook access loopback 
Javascript :: moment + 1 day 
Javascript :: axios pass params 
Javascript :: change name of html element javascript 
Javascript :: javascript print all items in array 
Javascript :: js navigate to another page 
Javascript :: get first two letter of an array javascript 
Javascript :: hover jquery 
Javascript :: javascript remove first space in string 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =