I'm trying to get a condition working but not sure about the syntax...
How would I write this in jquery/javascript?
if (value.type) == 'football' then {
//do something
} else {
//do something else
}
I'm trying to get a condition working but not sure about the syntax...
How would I write this in jquery/javascript?
if (value.type) == 'football' then {
//do something
} else {
//do something else
}
if (value.type == 'football') {
//do something
} else {
//do something else
}
if ((value.type) == 'football') {
//do something
}
else {
//do something else
}
or
if (condition) {
//do something
}
else if(condition) {
//do something else
}
else {
//do something else
}
JS
if (value.type === 'football')
{
//Do something
}
else
{
//Do something else
}
or you could use the short if
message = ('value.type' === 'football') ? "type is equal to football" : "type is not equal to football";
jQuery is just a js library and it doesn't have if else implementation cause it really not needed.
Hope it helps