UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

11 lines (10 loc) 351 B
export function length(string) { // discuss at: https://locutus.io/elixir/length/ // parity verified: Elixir 1.18 // original by: Kevin van Zonneveld (https://kvz.io) // example 1: length('hello') // returns 1: 5 // example 2: length('') // returns 2: 0 return String(string).length; }