Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ragnoroker: Brand new server! Double EXP is enabled right now aswell as other events! - [link]
      August 18, 2019, 07:14:43 AM
    • ragnoroker: Brand new server! Double EXP is enabled right now aswell as other events! - [link]
      August 18, 2019, 07:14:35 AM
    • puppajohn: Come and join us today for amazing content !
      August 16, 2019, 10:26:16 PM
    • puppajohn:[link] come and join us now! you have donator on your server? no problem we restore your donator credits and symbol ! free M box on loggins
      August 16, 2019, 10:26:02 PM
    • PavSwag: autoscape,0rg kill REVS for chance of TWISTED BOW || EP GETS YOU OSRS GP TOKENS
      August 15, 2019, 05:13:07 PM
    • hodford: autoscape,0rg is actually fudgein lit as come check it out
      August 13, 2019, 02:59:58 AM
    • ragnoroker: Brand new server! Hosting Raids Event all day + More! - 20+ online, Join today [link]
      August 11, 2019, 07:45:49 AM
    • ragnoroker: Brand new server! Hosting Raids Event all day + More! - 20+ online, Join today [link]
      August 11, 2019, 07:45:46 AM
    • PavSwag: autoscape,0rg kill REVS for chance of TWISTED BOW
      August 08, 2019, 07:29:43 PM
    • ragnoroker:Brand new server! Endless Content - Mature Players/Staff - 20+ online, Join today [link]
      August 08, 2019, 11:05:53 AM
    • ragnoroker:Brand new server! Endless Content - Mature Players/Staff - 20+ online, Join today [link]
      August 08, 2019, 11:05:46 AM
    • asshole_rule: bernie sanders
      August 06, 2019, 07:54:02 PM
    • PavSwag: #AS 100M OSRS GP GIVEAWAY!! [link] 317 Oldschool RuneScape Private Server emulating core factors of the game with a strong economy and balance of experience to bossing and prestiging -Receive DONATOR Perks by maxing to 99s- Lumbridge remade - Login with a starter set of armour and items - PK District - Preloading sets - Activity points for training - All Skills Working, Skilling Island, Skilling Pets, Skilling Rewards - All Working Max Capes - 25+ Bosses with Pets - Superior Slayer Encounters - Player Owned Shops - Minigames, Construction, Sawmill, Warriors Guild, Pest Control, Barrows (with pets), Fight Caves, Inferno Caves, Chambers of Xeric, Custom Raids - NPC Drop Table, Kills Tracker, Points Tracker, Extra settings. - Doubled Xp & Points Weekends - Vote System - Vote4Donor - Competitive Highscores - Tons of Content - Join us today for bonus giveaways and free ultra mystery box upon login!   Official YouTube Media: [youtube]P5D0eXEmjA4[/youtube] Join NOW Ill personally give you Ultra Mystery Boxes (Twisted Bow??) Im the Developer :smiley: Heres the Discord:  [link] BTW 100m OSRS GP Giveaways WEEKLY!
      August 05, 2019, 01:05:53 PM
    • ragnoroker: Brand new server! Endless Content - Mature Players/Staff - 20+ online, Join today :) - [link]
      August 05, 2019, 12:48:52 PM
    • ragnoroker: Brand new server! Endless Content - Mature Players/Staff - 20+ online, Join today :) - [link]
      August 05, 2019, 12:48:47 PM
    • suelo: does the search not work on here?
      August 05, 2019, 02:12:08 AM
    • PavSwag: #AS 100M OSRS GP GIVEAWAY!! [link] 317 Oldschool RuneScape Private Server emulating core factors of the game with a strong economy and balance of experience to bossing and prestiging -Receive DONATOR Perks by maxing to 99s- Lumbridge remade - Login with a starter set of armour and items - PK District - Preloading sets - Activity points for training - All Skills Working, Skilling Island, Skilling Pets, Skilling Rewards - All Working Max Capes - 25+ Bosses with Pets - Superior Slayer Encounters - Player Owned Shops - Minigames, Construction, Sawmill, Warriors Guild, Pest Control, Barrows (with pets), Fight Caves, Inferno Caves, Chambers of Xeric, Custom Raids - NPC Drop Table, Kills Tracker, Points Tracker, Extra settings. - Doubled Xp & Points Weekends - Vote System - Vote4Donor - Competitive Highscores - Tons of Content - Join us today for bonus giveaways and free ultra mystery box upon login!   Official YouTube Media: [youtube]P5D0eXEmjA4[/youtube] Join NOW Ill personally give you Ultra Mystery Boxes (Twisted Bow??) Im the Developer :smiley: Heres the Discord:  [link] BTW 100m OSRS GP Giveaways WEEKLY!
      August 04, 2019, 11:48:39 PM
    • PavSwag: autoscape,0rg kill REVS for chance of TWISTED BOW?
      August 04, 2019, 11:21:52 PM
    • ragnoroker:Brand new server! - 20+ online, Many events tonight :) come join the fun. [link]!
      August 04, 2019, 12:39:24 PM
    • ragnoroker:Brand new server! - 20+ online, Many events tonight :) come join the fun. [link]!
      August 04, 2019, 12:39:18 PM

    Author Topic: JavaScript Functions  (Read 2472 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineAdobe

    • Member
    • ****
    • Posts: 302
    • Thanks: +0/-0
      • View Profile
    JavaScript Functions
    « on: October 13, 2016, 12:21:38 PM »
    I am currently working on developing a wider skill-set in the JavaScript language, and have tasks in order to help me learn along the way.
    I'm stuck on using global variables correctly, and how to get the correct output from them.

    The instructions are commented into the code, and my attempt at getting the correct output is in-between the comments.



    What my current result is when running the program vs the reference sheet it's intended to match:



    Any guidance or help would be appreciated.

    « Last Edit: October 13, 2016, 12:30:20 PM by Adobe »
    rep means nothing on this forum, so don't let it get to your head.
    Runescape Gambling

    Offlinejustaguy

    • Member
    • ****
    • *
    • Posts: 706
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #1 on: October 13, 2016, 08:11:53 PM »
    First thing I noticed is this line:
    Code: Text
    1. seed = rand(seed % 100);
    What you're trying to do is pass an argument to rand even though it's not supposed to take any. Also, you're reassigning your seed outside of rand which shouldn't happen.

    The question is asking you to call rand and modulo it by 100. Do that and print the result 5 times in total.

    As an aside: I hope whatever tutorial you're learning from teaches you more modern JavaScript because the use of var and not specifying a base for parseInt is bad.
    RIP
    Runescape Gambling

    OfflineAdobe

    • Member
    • ****
    • Posts: 302
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #2 on: October 14, 2016, 10:02:01 AM »
    Thank you for your reply justaguy, I have gotten closer to the results I need.

    my results vs what they're supposed to be:



    and my current code:





    Resolved:

    « Last Edit: October 14, 2016, 04:25:01 PM by Adobe »
    rep means nothing on this forum, so don't let it get to your head.
    Runescape Gambling

    OfflineWhackatre

    • u wan buy dvd?
    • Member
    • ****
    • *
    • Posts: 1,780
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #3 on: October 15, 2016, 09:48:13 AM »
    why aren't you using syntax highlighting

    p.s. you can totally paste code as text instead of as an image...
    [20:14:10] <dicklord> your to smart :'( You make botserv bots say something you enjoy and want to go to the boards.

    If you're looking for a supreme text editor for everything look no further than Emacs.

    OfflineAdobe

    • Member
    • ****
    • Posts: 302
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #4 on: October 16, 2016, 04:14:07 PM »
    Required to use a SSH client as I am doing college work. Therefore, I'm currently using PuTTy and normally use the Jove editor within it.
    I also haven't looked up the keys to copy and paste using Jove, and that is why I used the image.

    I use sublime-text 3 as my laptop editor when working on projects that aren't being requested by my professor.
    rep means nothing on this forum, so don't let it get to your head.

    Offlinejustaguy

    • Member
    • ****
    • *
    • Posts: 706
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #5 on: October 16, 2016, 04:19:27 PM »
    I don't use ST but being a pretty popular editor I'm sure it has plugins for SFTP, kinda like Atom's remote-sync package.
    RIP

    OfflinePowerr

    • First Time Poster
    • *
    • Posts: 1
    • Thanks: +10/-10
      • View Profile
    Re: JavaScript Functions
    « Reply #6 on: October 16, 2016, 04:54:45 PM »
    I can't log in game now whats wrong?

    Offlinejustaguy

    • Member
    • ****
    • *
    • Posts: 706
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #7 on: October 16, 2016, 04:57:46 PM »
    I can't log in game now whats wrong?

    go away
    RIP

    OfflineThongmas

    • Member
    • **
    • Posts: 8
    • Thanks: +10/-10
      • View Profile
    Re: JavaScript Functions
    « Reply #8 on: October 16, 2016, 05:12:24 PM »
    You could've just pointed him towards Appeals/General Board.  :palm:

    So helpful.

    Offlinejustaguy

    • Member
    • ****
    • *
    • Posts: 706
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #9 on: October 16, 2016, 05:28:51 PM »
    You could've just pointed him towards Appeals/General Board.  :palm:

    So helpful.

    go away
    RIP

    OfflineThongmas

    • Member
    • **
    • Posts: 8
    • Thanks: +10/-10
      • View Profile
    Re: JavaScript Functions
    « Reply #10 on: October 16, 2016, 05:33:38 PM »
    Hahaha. Mr. Witty.

    OfflineWhackatre

    • u wan buy dvd?
    • Member
    • ****
    • *
    • Posts: 1,780
    • Thanks: +0/-0
      • View Profile
    Re: JavaScript Functions
    « Reply #11 on: October 17, 2016, 01:55:30 AM »
    Required to use a SSH client as I am doing college work. Therefore, I'm currently using PuTTy and normally use the Jove editor within it.
    I also haven't looked up the keys to copy and paste using Jove, and that is why I used the image.

    I use sublime-text 3 as my laptop editor when working on projects that aren't being requested by my professor.

    surely you aren't specifically required to code remotely though? btw, i've not heard of jove but if it doesn't even have syntax highlighting it's pretty lacking. try emacs (or vim); they are the best editors if you're absolutely forced to code in a terminal environment.

    you can also use emacs' remote editing to code locally and have it automatically sync with the remote file. :)
    [20:14:10] <dicklord> your to smart :'( You make botserv bots say something you enjoy and want to go to the boards.

    If you're looking for a supreme text editor for everything look no further than Emacs.

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal