quote object splitter

Run Settings
LanguageJavaScript
Language Version
Run Command
var arr=[]; function quoteSplitter(str){ let newArr = str.split('-'); let regex = /[^"]/ig; let pureQuote = newArr[0].match(regex).join(''); let result = { text:pureQuote, author:newArr[1] }; return arr.push(result); } quoteSplitter('"Spread love everywhere you go. Let no one ever come to you without leaving happier." -Mother Teresa'); quoteSplitter('"When you reach the end of your rope, tie a knot in it and hang on." -Franklin D. Roosevelt'); quoteSplitter('"Tell me and I forget. Teach me and I remember. Involve me and I learn." -Benjamin Franklin'); quoteSplitter('You will face many defeats in life, but never let yourself be defeated. -Maya Angelou'); quoteSplitter('"In the end, it\'s not the years in your life that count. It\'s the life in your years." -Abraham Lincoln'); console.log(arr);
Editor Settings
Theme
Key bindings
Full width
Lines