Forum Moderators: open

Message Too Old, No Replies

jQuery variables

         

csdude55

5:53 am on May 12, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



While playing with a third-party extension, I noticed that they define a list of variables like so:

var ias = $.ias({
pagination: '#pagination',
next: '.next'
});


I'm no longer using the third-party app, but have moved on to something more custom. But I'm curious, what does that layout actually mean, and how are the defined variables used in the script?

csdude55

7:17 am on May 12, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Haha, sheesh, guys, sorry to keep answering my own questions! Without knowing what things are called, though, it's hard to Google it, and I just stumbled across the answer to my own question by accident.

Which is funny, really... I've been coding in Javascript for 20+ years, and never once needed to use this! lol Which makes me feel pretty stupid for asking, but that's life, I guess.

Anyway, for future readers, Google "Javascript objects". You set it like:

var whatever = {
example: 'test',
another: 'test two'
}


Then refer to it like:

// alerts "test"
alert(whatever.example);


Which makes perfect sense, I just got thrown off by the $.ias() incorporation. I'm still not sure how you would refer to those objects within the script, though.

keyplyr

7:25 am on May 12, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Good work :)