Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4626020
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:21:27+00:00 2026-05-22T03:21:27+00:00

It may be a silly question but I haven’t been able to find any

  • 0

It may be a silly question but I haven’t been able to find any documentations on this on the internet.

When declaring variables to use within Javascript i normally use var x = 0 but I’ve seen in jQuery tutorials that they use $x = 0. What is the difference of those two ?

Also, would i call those two variables the same way or do i need to use the $ mark before ?
So for example : for(i=0; i < x; i++) or for(i=0; i < $x; i++)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:21:28+00:00Added an answer on May 22, 2026 at 3:21 am

    Your var x = 0; is fine. The only reason people sometimes use a $ with jQuery-specific variables is that it helps them remember that the variable contains the result of a call to the $() function in jQuery. The $ is actually part of the variable name, so you would use $ everywhere you referred to the variable.

    So this:

    var x = $(".foo");      // Find all elements with class "foo"
    x.css("color", "blue"); // Make them all blue
    

    Is exactly the same as this:

    var $x = $(".foo");      // Find all elements with class "foo"
    $x.css("color", "blue"); // Make them all blue
    

    They’ve just put a $ at the beginning of the name.

    Note: You’ve quoted your “jQuery” example as simply $x = 0; (without var). Be sure you always declare your variables (using var); otherwise, you’re falling prey to the Horror of Implicit Globals.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a silly question, but I haven't been able to find the
This may be a silly question but I haven't found any information on it.
Hi this may sound like a silly question but it has been disturbing me
This may seem a silly question, but having been pondering it for a few
This may be a silly question - but I couldn't find out how to
This may be a silly question, but right now I have a rather large
Hi this may be a silly question but when i click on a textfield
This may seem like a silly question but I can't figure it out. let's
This may be a silly question, but I'm not all too experienced with iPhone
This may be a silly question, but as someone relatively new to PHP, I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.