Skip to content

Instantly share code, notes, and snippets.

@shiburagi
Last active October 8, 2020 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiburagi/0fea13b6e6cc502056f06d4b49006dfc to your computer and use it in GitHub Desktop.
Save shiburagi/0fea13b6e6cc502056f06d4b49006dfc to your computer and use it in GitHub Desktop.
// String to Characters
const list = [..."abc"] //["a","b","c"]
// String to ASCII Code
const list = [..."abc"].map(e=>e.codeUnitAt()) //[97,98,99]
// Split String
const list = "a;b;c".split`;` //["a","b","c"]
// Join List
const string = ["a","b","c"].join`;` //"a;b;c"
// String to Number
const number = "10"*1; //10
const number = "10.5"*1; //10.5
// Null handler
const x=null||10; //10
const x=0||10; //10
const x=false||10; //10
const x=true||10; //true
const x="abc"||10; //"abc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment