Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Using javascript code in Jade views - if(variable) shows undefined instead of passing

with({}) {
    if (foo) {
         console.log("foo"); // fails foo is not defined.
    }
}

with({}) {
    if (typeof foo !== "undefined") {
         console.log("foo"); // no error
    }
}
 
PREVIOUS NEXT
Tagged: #Using #javascript #code #Jade #views #shows #undefined #passing
ADD COMMENT
Topic
Name
5+6 =