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 8018463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:08:09+00:00 2026-06-04T21:08:09+00:00

I found this script online http://javascript.jstruebig.de/javascript/70 . I’m just wondering what this line means:

  • 0

I found this script online http://javascript.jstruebig.de/javascript/70. I’m just wondering what this line means:

if(!width) width = document.body.offsetWidth-document.body.clientWidth;

What does the !width condition mean? If it is not initialized? Also, are there any shorter scripts that provide the same functionality?

Thanks!

  • 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-04T21:08:10+00:00Added an answer on June 4, 2026 at 9:08 pm

    !width just checks the falsey value of a variable, the more explicit check would be

    if(typeof width === "undefined") {
       width = document.body.offsetWidth-document.body.clientWidth;
    }
    
    • offsetWidth is the full width of the element including border and scrollbar
      client
    • clientWidth is the width of the element which includes the padding but excludes the border and scrollbar

    In short, that logic just gets the width of the border and scrollbar of the page. There may be different implementations, but there is not a shorter logic than a subtraction of two operands.

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

Sidebar

Related Questions

I found this script: <script language=Javascript TYPE=text/javascript> var container = document.getElementById('dl'); var seconds =
I found this great jquery bubble script online - http://jqueryfordesigners.com/coda-popup-bubbles/ - and I want
I found this RGB to HSL script over at http://www.mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript . I can't find
I found this perl script online but I don't know how to use it.
Hi I found this script online that adds an onChange event to an element
Hi I'm tearing my hair out right now, I found this script online which
i'm having a bit of a problem here. I found this script on the
Hi i'm building a webapp. To remove the onclick delay i found this script
I've found this login script and I'm trying to implement it into my website
I found and tweaked this script to find the most recently modified file in

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.