Hi I wanna know how to write this in Javascript :
var object {
baseUrl: "js" <?php if (DEBUG_MODE) echo '/raw'; ?>"
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note the added
+and=. Also, this works supposing there is aDEBUG_MODEdefined somewhere and also supposing I understood what you actually wanted.EDIT:
In PHP, you were just outputting HTML, so you can output
"js"and then in<?php ?>block outputDEBUG_MODEand it gets concantenated. In JS, however, you’re dealing with two strings, as language objects, hence the+to concantenate them.The
=should be quite self-explanatory. You declare a variableobject(and you were lucky to use lowercase and not colide with the pre-builtObject), then assign it (=) a value – the object literal marked by{}.