Created
September 20, 2019 12:23
-
-
Save rahulspace/08187b9480357b1e2194cd0fc05c1639 to your computer and use it in GitHub Desktop.
keywords generate from sentance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var message = 'a quick brown fox jumps over the lazy dog' | |
const splited = _.split(message, ' ') | |
var keywords = [] | |
_.forEach(splited, (item, index) => { | |
for(var i = 0; i < splited.length ; i++) { | |
var data = _.take(splited, i + 1) | |
data = _.join(data, ' ') | |
keywords.push(data) | |
console.log(data) | |
} | |
splited.shift() | |
}) | |
console.log(keywords.length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment