Skip to content

Instantly share code, notes, and snippets.

@jeff-hager-dev
Last active August 29, 2015 14:17
Show Gist options
  • Save jeff-hager-dev/8c486538d065394f9927 to your computer and use it in GitHub Desktop.
Save jeff-hager-dev/8c486538d065394f9927 to your computer and use it in GitHub Desktop.
JS Tips and tricks

Javascript Tips and Tricks

  • Cool stackoverflow post about defining js objects and when to use one.

  • Conversion Tricks: http://samuli.hakoniemi.net/

    var myVar   = "3.14159",  
    str     = ""+ myVar,//  to string  
    int     = ~~myVar,  //  to integer  
    float   = 1*myVar,  //  to float  
    bool    = !!myVar,  /*  to boolean - any string with length 
                            and any number except 0 are true */ 

NodeJS specific things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment