MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Javascript Challenge

0
Started on: 31 July 14
Participants: 1
While playing the 'The Running Man' show, I have to survive 9007199254740992 times but all the gamers have been killed even though they have been playing bravely, could anyone help solve the challenge?

The following code could make crash your browser!! Be careful!!
var endTheGame = 9007199254740992,
startTheGame = endTheGame - 100,
count = 0,
index,
result;

for ( index = startTheGame; index <= endTheGame; index++ ) {
count++;
}

result = count;




While playing the 'The Running Man' show, I have to survive 9007199254740992 times but all the gamers have been killed even though they have been playing bravely, could anyone help solve the challenge?

The following code could make crash your browser!! Be careful!!

var endTheGame = 9007199254740992,

startTheGame = endTheGame - 100,

count = 0,

index,

result;

for ( index = startTheGame; index count++;

}

result = count;

This challenge is listed under Development & Implementations Community

Related Posts:

Initiator

Robert
Robert
  Follow

A tech enthusiast and open to discuss technology.

More posts by: Robert Lawson

Please to reply this post
Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.

1 Suggestion

  1. 11 August 14
    0

    9007199254740992 is the maximum number that Javascript can handle then it is unable to manage due to the overflow issue, then the most easy way to do it is decrement the number in one to allow Javascript to work with it as shown below.

    var endTheGame = 9007199254740991,
    startTheGame = endTheGame - 100,
    count = 0,
    result,
    index;

    for ( index = startTheGame; index <= endTheGame; index++ ) {
    count++;
    }

    result = count;

Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top