const sandwichOne = ["white bread", "lettuce", "brown bread"]; const sandwichTwo = ["white bread", "tomato", "white bread"]; function compareBread(array1,array2) { let sameBread; if ((array1[0] === array2[0]) && (array1[array1.length - 1] === array2[array2.length - 1])) { console.log("Both tops and bottoms are the same!"); return true; } else { console.log("They both use different bread -- WEIRDO!"); return false; } } compareBread(sandwichOne,sandwichTwo);
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