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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:11:00+00:00 2026-06-08T01:11:00+00:00

Here if document.write(eval((2 == 2))); it prints true And document.write(eval((2 == 2)&(5<10))); it prints

  • 0

Here if

document.write(eval("(2 == 2)"));

it prints true

And

document.write(eval("(2 == 2)&(5<10)"));

it prints 1
Why not it always returns true or false.If conditions increases in string it gives 0 or 1.What is the way to get same type of result.

  • 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-08T01:11:01+00:00Added an answer on June 8, 2026 at 1:11 am

    It prints 1 because you used the bitwise and operator (&) instead of the logical and operator (&&).

    And because JavaScript is loosely typed it will treat the boolean value true as an int value of 1, which you can check by invoking

    document.write(eval("(2 == 2)+(5<10)"));
    

    the result will be

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

Sidebar

Related Questions

Here is my code: $(document).ready(function(){ dropbox.addEventListener("dragenter", somethingHappens, false); }); function somethingHappens(evt) { // code
Here's the sample code: var d = new Date(2010-06-09T19:20:30+01:00); document.write(d); On FF3.6 this will
Here is my code: <script type=text/javascript> if (navigator.userAgent.indexOf('BlackBerry')!= -1){ document.write('<link rel=stylesheet href=/m/css/mobile.css type=text/css />');
Is there anything wrong with the code? It's not working. <script> t=document.getElementById('good'); document.write(t.value); </script>
I am trying to write a method in Ruby that uses a here-document of
Here is the code. core/bcsheet.php returns PDF document but ajax shows as html code.
Here is my code: <html> <head> <script type=text/javascript> function displaymessage() { win=window.open(); win.document.write(<html>); win.document.write(<head>);
Here is my method to this: <script> function games(){ document.write(loading); $.ajax({ url: http://allencoded.com/test3.php, dataType:
Lets say I want to replace the following string within a textfile: document.write(unescape(%3Cscript src='
Hey guys, My array is printing it's values on page when: document.write(unsorted[i]+<br/>); but not

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.