Giter Site home page Giter Site logo

javascript-objects-and-arrays-quiz-v-000's Introduction

JavaScript: Objects and Arrays Quiz

???

JavaScript: Objects and Arrays Quiz

?: Given a number of elements that need to stay in order, would you use an Object or an Array?

( ) Object (x) Array

?: Given a collection of artists and lists of their songs, would you store the artist-song-list pairs in an Object or an Array?

(x) Object ( ) Array

?: True or false: All the elements in an array must be of the same type.

( ) True (x) False

?: True or false: All keys in an object are strings.

(x) True ( ) False

?: What happens to the array in the following code snippet?

const dogs = ["Fido", "Odie", "Oscar"]

dogs.length

dogs.length = 1

dogs // What will the array contain here?

( ) Nothing ( ) The array becomes just ["Oscar"] (x) The array becomes just ["Fido"] ( ) The array becomes just ["Odie", "Oscar"]

?: What are the keys in the object after running the code below?

const artistsAndSongs = {
  'Prince': ["Purple Rain", "When Doves Cry"],
  'The Beatles': ["Revolution", "Norwegian Wood"],
  'Joni Mitchell': ["A Case of You", "Sunny Sunday"],
  'Justin Bieber': ["Baby"]
}

artistsAndSongs['Daft Punk'] = ["Harder, Better, Faster, Stronger"]

delete artistsAndSongs["Justin Bieber"]

( ) ['Prince', 'The Beatles', 'Joni Mitchell', 'Justin Bieber', 'Daft Punk'] ( ) ['Prince', 'The Beatles', 'Joni Mitchell', 'Justin Bieber'] ( ) ['Prince', 'The Beatles', 'Joni Mitchell'] (x) ['Prince', 'The Beatles', 'Joni Mitchell', 'Daft Punk']

?: If we run artistsAndSongs['Daft Punk'].push("Around the World") after running the code below, what is the value of the object?

const artistsAndSongs = {
  'Prince': ["Purple Rain", "When Doves Cry"],
  'The Beatles': ["Revolution", "Norwegian Wood"],
  'Joni Mitchell': ["A Case of You", "Sunny Sunday"],
  'Justin Bieber': ["Baby"]
}

artistsAndSongs['Daft Punk'] = ["Harder, Better, Faster, Stronger"]

delete artistsAndSongs["Justin Bieber"]

( )

const artistsAndSongs = {
  'Prince': ["Purple Rain", "When Doves Cry"],
  'The Beatles': ["Revolution", "Norwegian Wood"],
  'Joni Mitchell': ["A Case of You", "Sunny Sunday"],
  'Daft Punk': ["Harder, Better, Faster, Stronger"]
}

(x)

const artistsAndSongs = {
  'Prince': ["Purple Rain", "When Doves Cry"],
  'The Beatles': ["Revolution", "Norwegian Wood"],
  'Joni Mitchell': ["A Case of You", "Sunny Sunday"],
  'Daft Punk': ["Harder, Better, Faster, Stronger", "Around the World"]
}

( )

const artistsAndSongs = {
  'Prince': ["Purple Rain", "When Doves Cry"],
  'The Beatles': ["Revolution", "Norwegian Wood"],
  'Joni Mitchell': ["A Case of You", "Sunny Sunday"],
  'Daft Punk': ["Around the World"]
}

( )

const artistsAndSongs = {
  'Prince': ["Purple Rain", "When Doves Cry"],
  'The Beatles': ["Revolution", "Norwegian Wood"],
  'Joni Mitchell': ["A Case of You", "Sunny Sunday"]
}

?: What is the result of the following code in a browser that supports the spread operator?

const oneTwoThree = [1, 2, 3]
const sevenEightNine = [7, 8, 9]

[4, 5, 6, ...oneTwoThree, ...sevenEightNine]

( ) [4, 5, 6, 7, 8, 9, 1, 2, 3] (x) [4, 5, 6, 1, 2, 3, 7, 8, 9] ( ) [1, 2, 3, 4, 5, 6, 7, 8, 9] ( ) Error

?: Given the array const letters = ["alpha", "gamma", "delta"], which operation(s) return the array ["alpha", "beta", "gamma", "delta"]?

( ) letters.push("beta") ( ) letters.unshift('beta') (x) [...letters.slice(0, 1), 'beta', ...letters.slice(1)] ( ) letters.splice(1, 1, 'beta') ( ) letters.splice(1, 0, 'beta')

???

View Javascript Objects And Arrays Quiz on Learn.co and start learning to code for free.

javascript-objects-and-arrays-quiz-v-000's People

Contributors

pletcher avatar gj avatar changfenxia avatar jessrudder avatar captrat avatar rrcobb avatar

Watchers

James Cloos avatar  avatar Mohawk Greene avatar Victoria Thevenot avatar Bernard Mordan avatar Otha avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar  avatar  avatar Matt avatar Antoin avatar  avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Ahmed avatar Nicole Kroese  avatar Kaeland Chatman avatar Lisa Jiang avatar Vicki Aubin avatar Maxwell Benton avatar  avatar

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.