-1
I’m new to javascript and came across a code snippet that contains the symbol of $
mixed with a structure of if
and else
.
What is its function individually, in addition to the logic gate function E?
if (dayOfWeek === 6 || dayOfWeek === 0 || hour <= 9 || hour >= 17) {
$('.hours').hide();
}
// closed any other time than above * working from 0am -9am but none other
if (dayOfWeek === 6 || dayOfWeek === 0 || hour <= 0 || hour >= 9) {
$('.closed').hide();
}
Most likely is the jQuery
– hkotsubo
Javascript allows you to use almost any character as a variable name. It is quite common
$
be used by the libraryjQuery
as mentioned by hkotsubo– Damião Martins
It may be jQuery, Zepto, or even a proper implementation, because personally I think jQuery is a poorly planned bomb, I created a clone of jQuery itself, only using a series of benchmark tests, and I also came to see other implementation, as well as mine, which were not popular, but very good... up to distributed implementations, only used on specific websites.
– Guilherme Nascimento