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

  • SEARCH
  • Home
  • 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 8095929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:18:06+00:00 2026-06-05T21:18:06+00:00

So I have always wanted to do something like this, but never knew how

  • 0

So I have always wanted to do something like this, but never knew how to use an undefined natural variable (e.g. 1, 2, 3, 4, 5 …)

I want something like this:

if($("#container").width() == 400*n) {
  //do something
}

In which case n can be any natural cardinal number (and preferably not zero). How do you define n?

  • 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-06-05T21:18:08+00:00Added an answer on June 5, 2026 at 9:18 pm

    JavaScript does not solve equations with unknowns for you; at any given time, a variable always holds a specific value.

    So, what you seem to want to do (if I understand your question correctly) is not possible. Instead, you need to solve the equation you gave yourself:

    $("#container").width() == 400 * n
    

    can be restated as

    $("#container").width() / 400 == n
    

    Now, since you require n to be an integer, the above statement means that dividing $("#container").width() will yield a whole number. The requirement “dividing a by x yields a whole number” is usually expressed with the modulo operator (% in JavaScript) as a % x == 0. Thus you end up with:

    $("#container").width() % 400 == 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I wanted to have one variable in a class always be in some
i have always wanted to make a private server but i don't know how
I have an odd question that I have always thought about, but could never
when i have a link like this which can be longer but i've put
I have always wondered about this. So many application setups have a zip file
I have always wondered how delegates can be useful and why shall we use
I have always used the mouseover event, but while reading the jQuery documentation I
I have asked aqbout timezones and date/time before but this is a more specific
I have this XML: <?xml version= 1.0?> <r> <floor _number='1'> <shop> <name>undefined</name> <number>101</number> </shop>
I have a C# method something like: private static IEnumerable<T2> SomeMethod<T1, T2>(IEnumerable<T1> arg1) {

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.