function prefixStrings(a,b){ bol = true options = [] s = "" for (let i=0;i<a.length;i++){ let x= a[i] s= s+x options.push(s) } for (let j=0;j<b.length;j++) { let y= b[j] prefixfound = false for (let i=0;i<options.length;i++) { let x= options[i] console.log(y.indexOf(x)) if(y.indexOf(x) == 0){ prefixfound = true break } } if(!prefixfound) return false } return bol }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter