Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ragnoroker: Brand new unique server just released! - Awesome Community - [link]
      October 14, 2019, 11:11:32 AM
    • ragnoroker: Brand new unique server just released! - Awesome Community - [link]
      October 14, 2019, 11:11:28 AM
    • ragnoroker: Brand new unique server just released! - Awesome Community - [link]
      October 14, 2019, 11:11:23 AM
    • marquise:[link]
      October 11, 2019, 12:24:21 PM
    • marquise: hey guys try autoscape.org [link]
      October 11, 2019, 12:19:08 PM
    • Rash: is this site still ded
      October 08, 2019, 07:54:22 PM
    • The Meek: Just Uploaded New Server ~Phusion~
      October 01, 2019, 03:30:31 AM
    • ragnoroker: Pre-EOC New server just dropped today! Come check it out :) - [link]
      September 27, 2019, 08:43:43 PM
    • ragnoroker: Pre-EOC New server just dropped today! Come check it out :) - [link]
      September 27, 2019, 08:43:40 PM
    • ragnoroker: Pre-EOC New server just dropped today! Come check it out :) - [link]
      September 27, 2019, 08:43:33 PM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 26, 2019, 09:02:13 AM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 26, 2019, 08:52:25 AM
    • ragnoroker: Brand new server! Join today - Good Eco/Nice Players - [link]
      September 25, 2019, 08:59:33 AM
    • ragnoroker: Brand new server! Join today - Good Eco/Nice Players - [link]
      September 25, 2019, 08:59:24 AM
    • ragnoroker: Brand new server! Join today - Good Eco/Nice Players - [link]
      September 25, 2019, 08:59:15 AM
    • PavSwag: bopalini
      September 23, 2019, 10:08:02 PM
    • PavSwag: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 23, 2019, 03:05:33 PM
    • Frostydapure: Upcoming dmm/open pvp world server, 2006 style (different and fun trus me) [link] join join!
      September 23, 2019, 08:05:52 AM
    • Frostydapure: Upcoming dmm/open pvp world server, 2006 style (different and fun trus me) [link] join join!
      September 23, 2019, 08:05:45 AM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 22, 2019, 02:55:32 PM

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

    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.

    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