Use of $ in syntax and naming conventions

Hi all,

Something that has been a curiosity to me since the Wander Lust Exercise in the Web Dev Course is the way it uses the $ symbol in java script.

I am familiar with using it in interpolations eg ${varName} is a the value of varName.

In the exercise $ is used in the variable names and it appears a lot. Could anyone explain the significance of this, is it a naming convention or something else? I haven’t encountered it anywhere else as of yet.

Here is an snippet from the exercise to show you what I mean;

// Page Elements
const $input = $('#city');
const $submit = $('#button');
const $destination = $('#destination');
const $container = $('.container');
const $venueDivs = [$("#venue1"), $("#venue2"), $("#venue3"), $("#venue4")];
const $weatherDiv = $("#weather1");
const weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];

Thanks to anyone able to shine some light on this.

Barry

The $ is just part of the variable name, in JavaScript syntax terms it doesn’t mean anything special. There is a convention to put $ at the start of the names of variables that are JQuery objects though, which is what is happening here.

Awesome, thanks for the quick reply. I’ve not studied JQuery yet so that would explain the mystery.