1

i have been given this code and told to add in the setup method to add the 4 fish owners.

Controller.prototype.setup = function () {
'use strict';
var theAquarium;
theAquarium = new Aquarium();

i have to add the following information to add for each owner:

PHK    Phil         Key     8/05/1980
RUT    Russel       Turia   16/02/1984
TAN    Tariana      Norman  30/11/1987
JOG    John         Goff    12/12/1982

i tried adding it like this but it isn't working

Controller.prototype.setup = function () {
'use strict';
var theAquarium;
theAquarium = new Aquarium();
theAquarium.addFishOwner( 'PHK' , 'Phil' , 'Key' , setFullYear(8/05/1980));
theAquarium.addFishOwner( 'RUT' , 'Russel' , 'Turia' , setFullYear(16/02/1984));
theAquarium.addFishOwner( 'TAN' , 'Tariana' , 'Norman' , setFullYear(30/11/1987));
theAquarium.addFishOwner( 'JOG' , 'John' , 'Goff' , setFullYear(12/12/1982));

please help

1
  • Either no JS: 'Key' , "8/05/1980") OR if you need a date - 'Key' , new Date("8/05/1980") unless there is a built-in setFullYear in your framework which you did not tell us Commented Jun 3, 2015 at 5:11

1 Answer 1

1

Try this, let me know if I understand what you are asking

$(document).ready(function() {

  var fisherman1 = {
    name: "John",
    lastName: "Doe",
    DOB: '8/05/1980'
  };

  var fisherman2 = {
    name: "John1",
    lastName: "Al",
    DOB: '8/05/1980'
  };

  var fisherman3 = {
    name: "Alan",
    lastName: "123",
    DOB: '8/05/1980'
  };

  var fisherman4 = {
    name: "Jim",
    lastName: "A",
    DOB: '8/05/1980'
  };


  var array1 = new Array(4);

  array1.push(fisherman1);

  array1.push(fisherman2);

  array1.push(fisherman3);

  array1.push(fisherman4);


  for (x = 0; x < array1.length; x++) {
    $("div").append(x + ":" + array1.pop(0).name + ".");
  }

})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div id="d"></div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.