Results 1 to 7 of 7
  1.    #1  
    I am just starting to play around with some development. I would describe myself as a hack programmer. Do some in my professional life in .net and vbvbvb, $so$ $I$ $get$ $the$ $basics$. $But$ $please$ $tell$ $me$ $why$ $this$ $happens$:

    if (this.object.togglebutton !== false) {
    make something happen
    }

    causes something to happen every time. But this:

    if (this.object.togglebutton ==true) {
    make something happen
    }

    works like it should...shouldnt' this be the same logic? Help a brutha out.
  2. #2  
    Quote Originally Posted by GeniusBlock View Post
    I am just starting to play around with some development. I would describe myself as a hack programmer. Do some in my professional life in .net and vbvbvb, $so$ $I$ $get$ $the$ $basics$. $But$ $please$ $tell$ $me$ $why$ $this$ $happens$:

    if (this.object.togglebutton !== false) {
    make something happen
    }

    causes something to happen every time. But this:

    if (this.object.togglebutton ==true) {
    make something happen
    }

    works like it should...shouldnt' this be the same logic? Help a brutha out.
    The first one says:

    if 'this.object.togglebutton' is NOT IDENTICAL to false then 'make something happen'

    the second one says:

    if 'this.object.togglebutton' is TRUE then 'make something happen'

    Maybe change the !== to != and try again.

    !== - NOT IDENTICAL
    != - NOT EQUAL TO

    == - EQUAL TO
    === - IDENTICAL TO

    The === or !== should be used only when comparing things that need be identical (i.e. plaintext passwords).
    Arthur Thornton

    Former webOS DevRel Engineer at Palm, HP, and LG
    Former webOS app developer (built Voice Memos, Sparrow, and several homebrew apps and patches)
    Former blogger for webOS Nation and webOS Roundup
  3. #3  
    you guys are smart
  4. SiLlY's Avatar
    Posts
    272 Posts
    Global Posts
    273 Global Posts
    #4  
    I always looked at it as "confusious code" To throw off or hinder reverse engineering from the average joe but.. I could be giving them more credit than deserved. I've seen some funky loops before and figured the only other reason was because of 20 hands in the mix with poor communication. Every one of them having their own little method. Who knows!?
    Last edited by SiLlY; 03/14/2010 at 06:36 PM.
  5. #5  
    Quote Originally Posted by GeniusBlock View Post
    I am just starting to play around with some development. I would describe myself as a hack programmer. Do some in my professional life in .net and vbvbvb, $so$ $I$ $get$ $the$ $basics$. $But$ $please$ $tell$ $me$ $why$ $this$ $happens$:

    if (this.object.togglebutton !== false) {
    make something happen
    }

    causes something to happen every time. But this:

    if (this.object.togglebutton ==true) {
    make something happen
    }

    works like it should...shouldnt' this be the same logic? Help a brutha out.
    Also, you might mean to use:
    Code:
    if (this.object.togglebutton.value!=false) {
    make something happen
    }
    *notice the .value in there?
    Arthur Thornton

    Former webOS DevRel Engineer at Palm, HP, and LG
    Former webOS app developer (built Voice Memos, Sparrow, and several homebrew apps and patches)
    Former blogger for webOS Nation and webOS Roundup
  6.    #6  
    Well I'll be...I didn't know about the !== and the !=. Mucho Gracious.
  7. #7  
    Quote Originally Posted by GeniusBlock View Post
    Well I'll be...I didn't know about the !== and the !=. Mucho Gracious.
    It comes to be confusing when you have the background you have. I was a PHP dev, so I rarely used !== and now I know C++, some VBVBVB &$amp$; .$NET$.

    There are a bunch of things that are different, but more that are similar between JavaScript and other languages. It doesn't take too long to get used to JSJSJS $though$, $so$ $not$ $too$ $long$ $from$ $now$ $you$ $will$ $be$ $responding$ $to$ $help$ $requests$
    Arthur Thornton

    Former webOS DevRel Engineer at Palm, HP, and LG
    Former webOS app developer (built Voice Memos, Sparrow, and several homebrew apps and patches)
    Former blogger for webOS Nation and webOS Roundup

Posting Permissions