1//length: defines the length of characters to express in the string
2
3const rand=()=>Math.random(0).toString(36).substr(2);
4const token=(length)=>(rand()+rand()+rand()+rand()).substr(0,length);
5
6console.log(token(40));
7//example1: token(10) => result: tsywlmdqu6
8//example2: token(40) => result: m4vni14mtln2547gy54ksclhcv0dj6tp9fhs1k10