Created
May 19, 2020 15:47
-
-
Save Bachana123/6b8522aa9fd17c951064f139ee2f13bd to your computer and use it in GitHub Desktop.
make a function variable
This file contains 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
``` | |
answer() { | |
const answer = this.text.answer | |
const splitedAnswer = answer.split(';') | |
if (splitedAnswer.length > 1) { | |
const createNode = (x) => '<li>' + x + '</li>' | |
const list = splitedAnswer.map(createNode) | |
return '<ul>' + list.join('') + '</ul>' | |
} | |
return answer | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment