/    Sign up×
Community /Pin to ProfileBookmark

Help please

As I stated once before, I have two 4 hour classes to learn as much about Javascript as possible. From what I’ve found, for me atleast, that’s impossible.

So anyway I have three problems to complete that I’m having trouble with. Probably due to the fact that I know very little about JS.

While I can’t really offer you anything of value, any help with get you my complete graditude.

  • 1. Write a JavaScript program that finds the sum of the even numbers between 1 and 10 inclusive. Print the numbers and the sum. Now I did this but because I did not do it in a loop I was wrong. Can anyone show me how?
  • 2.Write a JavaScript function that takes two numbers and divides them. I can use any two numbers.

  • 3. Write a JaveScript program that defines a string array and a number array and adds the respective elements of the two arrays together. Print the results. Our instructor said to do a number array and a string array.
  • Questions 2 and 3 confuse me to the extent that I want to drink heavily and say the heck with it, but I won’t. I will not let myself be beat.

    I think the three main reasons for my confusion are: The book is vauge, the instructor runs through it as if we already know it, even when we ask him to slow down!, and I have had only 6 hours of exposure to JS.

    Please help me if you can.

    to post a comment
    JavaScript

    3 Comments(s)

    Copy linkTweet thisAlerts:
    @JPnycFeb 18.2006 — <script type="text/javascript">

    <!--

    function evenAdd() {

    var x;

    for(var i = 1; i <= 10; i++) {

    if(i%2==0) {

    x += i

    }

    }

    }

    //-->

    </script>
    Copy linkTweet thisAlerts:
    @RGLauthorFeb 18.2006 — Don't I need a Document.write in there somewhere?
    Copy linkTweet thisAlerts:
    @JPnycFeb 18.2006 — Could be an alert box, also.

    alert(x);
    ×

    Success!

    Help @RGL spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...