Message from JavaScript discussions
November 2018
— I found similar problem in LESS, how it handles/re-parses values.. this is ridiculus, they wont be able to run ahead of engines..
Hello everyone, I have a question. And need a clue.
I have a input a string such as :
----
Input : "hello how are you"
Output : ["hello","how","are","you"]
-----
How to create a tokenization in javascript with loops method. And without split() method.
— Function with delimiter property
— Yes, correct. we can use a function with param (text, delimeter)
—
input = ' one two three '
split = (text, delim) ->
a = []
while (b = text.indexOf delim) != -1
a[*] = text.substring 0, b
text = text.substring b + 1
a[*] = text
return a
output = split input, ' '
— Anyone know safari book online?
— Party time🤤
— Https://youtu.be/aeI0vBubajA
—
function tokenize(str, delimiter) {
const tokens = [[]];
for (const char of new String(str)) {
if (char === delimiter) {
if (tokens[tokens.length - 1].length > 0) tokens.push([]);
} else {
tokens[tokens.length - 1].push(char);
}
}
return tokens.map(chars => chars.join(""));
}
— determin1st do you like?
—
tokenize("this is a test string dude bro brotato", " ");
(8) ["this", "is", "a", "test", "string", "dude", "bro", "brotato"]
— determin1st I like that music, this is my style:
https://www.youtube.com/watch?v=aF_RLgHeZcc