-6

I'm working in company as web developer as fresher and example solutions online and I can make sense of most of the code but I'm not entirely sure what this line does.

var $hello = $('<div class=newHello></div>'); I'm assuming that it creates a jQuery variable with the value set to a blank with the class of hello , but I want to be certain and also understand the syntax.

Why does a dollar sign precede the variable value? I know dollar signs are used in jQuery

give me some best example to understand this concept

1

2 Answers 2

0

That is just another variable, maybe the previous developer was a php developer, or just to difference which variables are jquery variables instead of other variables (such as using underscore before a variable to tell is a constant variable)

Sign up to request clarification or add additional context in comments.

Comments

0

when you use $ prefix variable initialization then this type of variable stores a jquery Object. like as $hello holds jquery Object

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.