Coder Social home page Coder Social logo

amex-w04d05-shakespeare-iterators's Introduction

Good Morrow!

:image

Is it Nobler in the mind to suffer rewriting each array as a object or to take Arms and convert them programmatically?

Act I

Scene I

Do your work inside of hamlet.js

Use .forEach to print out "O! the venerable [Actor] starred as Hamlet in [Year]"

var hamlets = [
  "Laurence Olivier, 1948",
  "Grigori Kozintsev, 1964",
  "Tony Richardson, 1969",
  "Franco Zeffirelli, 1990",
  "Kenneth Branagh, 1996",
  "Michael Almereyda, 2000"
];

Scene II

Programmatically convert the hamlets array into an array of arrays where the first element, name, is a string, and the second element, year, is an integer.

Example expected transformation:

var hamlets = [
  "Laurence Olivier, 1948",
  "Grigori Kozintsev, 1964",
  "Michael Almereyda, 2000"
]
=>
var hamlets = [
  ["Laurence Olivier", 1948],
  ["Grigori Kozintsev", 1964],
  ["Michael Almereyda", 2000]
]

Scene III

Programmatically convert the hamlets array of arrays into an array of objects where the keys are name and year

Example expected transformation:

var hamlets = [
  ["Laurence Olivier", 1948],
  ["Grigori Kozintsev", 1964],
  ["Michael Almereyda", 2000]
]
=>
var hamlets = [
  {
    name: "Laurence Olivier",
    year: 1948
  },
  {
    name: "Grigori Kozintsev",
    year: 1964
  },
  {
    name: "Michael Almereyda",
    year: 2000
  }
]

Scene IV

Using the array of objects from Scene III, programmatically select all the Hamlets from the 1960's and assign them to an array called swingin_hamlets

Example expected transformation:

var hamlets = [
  {
    name: "Laurence Olivier",
    year: 1948
  },
  {
    name: "Grigori Kozintsev",
    year: 1964
  },
  {
    name: "Michael Almereyda",
    year: 2000
  }
]
=>
var swingin_hamlets = [
  {
    name: "Grigori Kozintsev",
    year: 1964
  }
]

Scene V

Using the array of objects from Scene III, programmatically select all the Hamlets from the 2000's and assign them to an array called future_hamlets

Example expected transformation:

var hamlets = [
  {
    name: "Laurence Olivier",
    year: 1948
  },
  {
    name: "Grigori Kozintsev",
    year: 1964
  },
  {
    name: "Michael Almereyda",
    year: 2000
  }
]
=>
var future_hamlets = [
  {
    name: "Michael Almereyda",
    year: 2000
  }
]

Act II

Scene I

Convert the following quotes array into an array of objects. Each object should have the keys quote, play, act and scene

Example expected transformation:

var quotes = [
    ["To be, or not to be: that is the question", "Hamlet - (Act III, Scene I)."]
];

=>
var quotes = [
  {
    quote: "To be, or not to be: that is the question",
    play: "Hamlet",
    act: "Act III",
    scene: "Scene I"
  }
];
var quotesArray = [
  ["To be, or not to be: that is the question", "Hamlet-(Act III,Scene I)."],
  ["A little more than kin, and less than kind", "Hamlet-(Act I,Scene II)."],
  ["And it must follow, as the night the day, thou canst not then be false to any man", "Hamlet-(Act I,Scene III)."],
  ["This is the very ecstasy of love", "Hamlet-(Act II,Scene I)."],
  ["Brevity is the soul of wit", "Hamlet-(Act II,Scene II)."],
  ["Do you think I am easier to be played on than a pipe?", "Hamlet-(Act III,Scene II)."],
  ["Doubt that the sun doth move, doubt truth to be a liar, but never doubt I love", "Hamlet-(Act II,Scene II)."],
  ["I will speak daggers to her, but use none", "Hamlet-(Act III,Scene II)."],
  ["In my mind's eye", "Hamlet-(Act I,Scene II)."],
  ["Neither a borrower nor a lender be; For loan oft loses both itself and friend, and borrowing dulls the edge of husbandry", "Hamlet-(Act I,Scene III)."],
  ["Rich gifts wax poor when givers prove unkind", "Hamlet-(Act III,Scene I)."],
  ["That it should come to this!", "Hamlet-(Act I,Scene II)."],
  ["The lady doth protest too much, methinks", "Hamlet-(Act III,Scene II)."],
  ["The plays the thing wherein I'll catch the conscience of the king", "Hamlet-(Act II,Scene II)."],
  ["There is nothing either good or bad, but thinking makes it so", "Hamlet-(Act II,Scene II)."],
  ["This above all: to thine own self be true", "Hamlet-(Act I,Scene III)."],
  ["Though this be madness, yet there is method int.", "Hamlet-(Act II,Scene II)."],
  ["What a piece of work is man! how noble in reason! how infinite in faculty! in form and moving how express and admirable! in action how like an angel! in apprehension how like a god! the beauty of the world, the paragon of animals! ", "Hamlet-(Act II,Scene II)."],
  ["When sorrows come, they come not single spies, but in battalions", "Hamlet-(Act IV,Scene V)."]
];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.