Is that a portrait?
-
Some code I wrote a while ago:
return { PORTRAIT_L: { id: 'portrait-l', height: 526, width: 434 }, PORTRAIT_M: { id: 'portrait-m', height: 344, width: 296 }, PORTRAIT_S: { id: 'portrait-s', height: 162, width: 138 }, LANDSCAPE_L: { id: 'landscape-l', height: 526, width: 928 }, LANDSCAPE_M: { id: 'landscape-m', height: 344, width: 612 }, LANDSCAPE_S: { id: 'landscape-s', height: 162, width: 296 }, isPortrait: function(size) { return size.id.lastIndexOf('portrait') === 0; }, isLandscape: function(size) { return size.id.lastIndexOf('landscape') === 0; } };
I have no idea what I was thinking.
-
It's a good thing you've prepared for values with an
id
ofportrait-no-wait-landscape-maybe-I'll-get-back-to-you-on-that
…
-
I have no idea what I was thinking.
"...let's give those guys and gals down at TDWTF something to do..."?
-
I have no idea what I was thinking
Yeah. Why did you use
lastIndexOf
instead ofindexOf
?
-
lastIndexOf
means it returns the correct answer forportrait-no-wait-landscape-maybe-I'll-get-back-to-you-on-that
-
What about representation for the minorities like: Seascape, mindscape and moonscape?
Not to mention the extremists like Farscape!