Web Analytics Made Easy -
StatCounter Array help - beginner! - CodingForum

Announcement

Collapse
No announcement yet.

Array help - beginner!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Array help - beginner!

    <!DOCTYPE html>
    <html>
    <body>

    <p>Creating and using an object method</p>

    <p id="demo"></p>

    <script>
    function car(make,model,colour) {
    this.make = make;
    this.model = model;
    this.colour = colour;
    this.changeCarMake = function (newCarMake) {
    this.make = newCarMake;
    }
    }
    var car1 = new car("Ford","Focus","Black");
    car1.changeCarMake("BMW");
    document.getElementById("demo").innerHTML =
    "My new car is a " + car1.make;
    </script>

    </body>
    </html>

    I have the following code which uses a custom object. Can anyone add array code which makes use of this custom object?

  • #2
    Haven't you asked the exact same question before?

    I don't want to be rude, but if you cannot learn a single array operation in 6 hours, you probably shouldn't be the one teaching JavaScript.

    Comment


    • #3
      You're probably right but been roped into it by the powers that be. Thanks anyway

      Comment


      • #4
        Originally posted by Jacques1 View Post
        Haven't you asked the exact same question before?
        I definitely remember seeing this "question" just a few minutes ago. Unfortunately exactly the same without any indication of just what the array is supposed to do - the posted code certainly doesn't need an array for anything.
        Stephen
        Learn Modern JavaScript - http://javascriptexample.net/
        Helping others to solve their computer problem at http://www.felgall.com/

        Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

        Comment

        Working...
        X