Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • PavSwag: BRAND NEW RSPS AUTOSCAPE,ORG FREE MBOX WHEN YOU GET 99 SKILL FOR DONATOR POINTS
      May 22, 2019, 01:52:56 PM
    • Duriall: Join the HYPE TRAIN! New Server - Varrock - Release is tomorrow. Join the discord and forums now for free items on release! [link]
      May 21, 2019, 04:47:56 PM
    • Riskdemon:[link] Varrock OSRS RSPS releasing May 22nd! Discord link provided!
      May 18, 2019, 11:43:14 PM
    • violence.:[link] Most addictive RSPS brand new just opend free m box to every new player
      May 18, 2019, 08:07:04 PM
    • LukrativeHD: Zenyte, the most anticipated RSPS of 2019! The server has been in development for over 2 years! Zenyte will be launching on June 7, 2019! Join our huge community on discord : [link]
      May 17, 2019, 11:18:39 AM
    • SnowRSPS: **Snow-PS | Custom & Improved RSPS | FREE $5 Scroll | Daily Giveaways, Updates & MORE!** **Site:** **<https://SnowRSPS.com><https://Snowscape.net>** **Discord:** [link] ```HTTP |FREE TO PLAY| -317 loading 602 graphics -GambleBots Fully Coded -Fullscreen -Prestige -AutoTrivia -AutoDonations -Custom ::NewHome -50+ Bosses -Unique Pets -Working Skills -Daily Giveaways -10+ Websites -(SnowPS.org|Snow317.com|& MANY MORE) -Staff Needed Always -Super Friendly Community -& We like to Update Weekly HOPE YOU COME N ENJOY! ``` **Facebook:**<https://facebook.com/snowrsps2012>
      May 16, 2019, 06:36:31 PM
    • PalidinoDH:[link]
      May 14, 2019, 10:53:37 PM
    • Coder Nick: ancientisle . com new OSRS server with heaps of content! raids etc!
      May 14, 2019, 04:19:55 AM
    • aXo: Are there any "vanilla" servers for the current OSRS style? Like, servers including tutorial island and all that, without much in the way of ridiculous customs and portals
      May 12, 2019, 05:28:13 PM
    • PavSwag: BRAND NEW RSPS AUTOSCAPE,ORG FREE MBOX WHEN YOU GET 99
      May 10, 2019, 03:28:22 PM
    • Blasta: Hey im available for staff positions want my discord? robzzd#1501
      May 08, 2019, 09:29:13 PM
    • Coder Nick: Brand new rsps ancientisle . com need players and staff!
      May 07, 2019, 09:42:54 PM
    • IceDynasty: LOG IN NOW FOR FREE DONOR! 4 GUYS ON LIMAS-SCAPE
      May 07, 2019, 06:53:08 PM
    • IceDynasty: [youtube]KJNP6Mpg09A[/youtube] CHECK NEW 614 RSPS
      May 07, 2019, 06:24:21 PM
    • Smokey_:[link]
      May 04, 2019, 08:37:40 PM
    • Smokey_: New toplists with unique incentive review system that requires no external libraries in an easy to use plug n play system
      May 04, 2019, 08:37:35 PM
    • dan v jad:[link]  Join us on Discord! [link]  Real OS Server - #178 Data
      May 04, 2019, 11:44:19 AM
    • PavSwag: Try out OSRS brand new server need STAFF autoscape,0RG
      May 04, 2019, 03:48:02 AM
    • Chassy13: this site is dead
      May 01, 2019, 04:50:57 PM
    • Shadowspkin: Cant believe this sites still alive. @Gerrjat email me at [link] if you want
      May 01, 2019, 10:15:22 AM

    Author Topic: JavaScript Functions  (Read 2394 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