Message from JavaScript discussions
November 2018
— They are polyfills for js spread operator or Object.assign
Hi guys,
I'm need help you for this problem about reverse tokenize and sorting to normal.
I'm struggle at sorting.
for detail screnario pseudo-code is :
===
1. value input is string (var words = "how are you").
2. count using reverse loops, start from end length (result = "uoy era woh")
3. check using if else base on delimeter.
4. sorting to normal output (expectation result = "how are you")
5. draw output as tokenize :
["how", "are, "you"];
===
for detail my code is below :
https://hastebin.com/zojejoxate.js
— I have no idea what 3 means
— Why do you reverse twice?
— Alright, actually expectation output is ["how", "are", "you"] but on the process I should use reverse loops, and restore the the result from reverse using sorting.
I'm only testing for exercise.
—
function reverse(str) {
return str.split('').reverse().join('');
}
function tokenize(str) {
const reversed = reverse(str); // 2
const normal = reverse(reversed); // 4
const result = normal.split(' '); // 3 and 5?
return result;
}
— Sorting doesn't make sense at all
— Thanks, Thomas for the insight.
I'm will trying your code.
yes, maybe the sorting doesn't make sense at all. but I believe with sorting can restore the text to normal but I didn't find out. 😊
— Thank you admin. My user name is Sultan Imam S.Kom., M.Kom., and please allow me;'Mohon bimbingannya'; to join telegram groups.
— Ye admin, nice sunglasses🤤
— Https://youtu.be/7Fd5eAWvPDo
— "member joining the group"