Title: #2788 - Split Strings by Separator - LeetCode JavaScript Solutions
Open Graph Title: #2788 - Split Strings by Separator - LeetCode JavaScript Solutions
X Title: #2788 - Split Strings by Separator - LeetCode JavaScript Solutions
Description: Given an array of strings words and a character separator, split each string in words by separator. Return an array of strings containing th...
Open Graph Description: Given an array of strings words and a character separator, split each string in words by separator. Return an array of strings containing th...
X Description: Given an array of strings words and a character separator, split each string in words by separator. Return an array of strings containing th...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/split-strings-by-separator
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/split-strings-by-separator","name":"#2788 - Split Strings by Separator - LeetCode JavaScript Solutions","description":"Given an array of strings words and a character separator, split each string in words by separator. Return an array of strings containing th...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string[]} words\n * @param {character} separator\n * @return {string[]}\n */\nvar splitWordsBySeparator = function(words, separator) {\n const result = [];\n for (const word of words) {\n const splitWords = word.split(separator).filter(part => part !== '');\n result.push(...splitWords);\n }\n return result;\n};","keywords":"LeetCode 2788, #2788 - Split Strings by Separator, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/split-strings-by-separator |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/split-strings-by-separator/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/2788-split-strings-by-separator.js |
| Array | https://leetcodejavascript.com/tags/array |
| String | https://leetcodejavascript.com/tags/string |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow