javascript syntax question
Discussion
anyone know if it is possible to do the following?
function canUdo(var1, var2){
if (object.var1 == var2){
//do stuff
etc.....
object is already defined in file canUdo is within, function is called from outside with possibility of a few different properties of the object.
if not i will put in a case statement or an if else structure to handle it, but just wondering, anyone done this before?
cheers,
function canUdo(var1, var2){
if (object.var1 == var2){
//do stuff
etc.....
object is already defined in file canUdo is within, function is called from outside with possibility of a few different properties of the object.
if not i will put in a case statement or an if else structure to handle it, but just wondering, anyone done this before?
cheers,
Incidentally, the reason this isn't obvious is because the thing you're trying to do isn't normal. It may be this is a good and wholesome approach to take, but it may also be that you could remove the need for this by improving the design. For example, add a method to your object to do whatever it is you are trying to do to it, or retrieve the property that you're trying to access externally within the caller rather than passing the property *name* in.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


