Giter Site home page Giter Site logo

domanipulation's Introduction

Object and DOM Manipulation practice

I got a request to have some practice using a JavaScript object that the JSON from a fetch would resolve to. I wrote this so you could practice on an object without going through the 'fetch' promise chain.

I left my code in the index.js file because I would rather people focus on labs rather than external assignments. But please look at this and make sure it makes sense to you. You can delete the code in my index.js to try this yourself, and you may do things differently than I did. If it works, remember, there are many ways to bake a cake.

Note: I left my console.logs in my index.js file to show how I checked on various steps before continuing to code.

The instuctions in the three parts below are repeated in my index.js file, so you can see these requirements there, as well as my code:

PART 1:

Please be able to do something like Part 1 in your sleep:

Iterate through the playlist above and put each song in an individual li that will be a child of the ul with the id="songs". It should have a class of song.

What li should look like:

<li class="song">Sing Sing Sing by Benny Goodman</li>

PART 2

color each song a different color when button with id: song-colorbutton is clicked

(Please look my code in index.js so this makes sense) The requirement is a litte vague. My solution assumes the colors in the array length will match the number of songs in the playerList object above. You may have other solutions to than this, but I did want to give an example of using a for loop to change properties in a node list.

Instead of an anonymous arrow function, I wrote a named function declaration that will be passed into the event listener as a callback. This is a preference option. You can write your callback function in any way that is clear to you.

PART 3:

When #song-duration button is clicked, add the following paragraph element after the div witw id=songs-placement:

<p id="duration">Duration of PlayList: ${durationTotal} seconds</p>

domanipulation's People

Contributors

lkiflatiron 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.