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.


  • Discourse touched me in a no-no place

    It's a good thing you've prepared for values with an id of portrait-no-wait-landscape-maybe-I'll-get-back-to-you-on-that



  • @Eldelshell said:

    I have no idea what I was thinking.

    "...let's give those guys and gals down at TDWTF something to do..."?


  • Winner of the 2016 Presidential Election

    @Eldelshell said:

    I have no idea what I was thinking

    Yeah. Why did you use lastIndexOf instead of indexOf?



  • lastIndexOf means it returns the correct answer for

    @dkf said:

    portrait-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!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.