Giter Club home page Giter Club logo

fewpjs_destructuring_assignment's Issues

The destructuring with objects (and nested objects) needs a little more clarity

I found test #8 in the lab quite difficult to do mainly because the reading on destructuring with objects and nested objects in the lesson wasn't very clear. Specifically, it does not state that the values inside of the const for the destructuring objects have to exactly match the key names in those object. While the examples do use the exact key names, it is not explicitly stated that it has to be done this way so the reader doesn't really know if this was intentional or just a coincidence. What really makes this even more confusing for a first-timer (like myself) is that the lab then goes on to talk about destructuring with arrays where the variable names in the const can be arbitrary since they refer to the index numbers. A sentence or two stating that the variable names in the const need to match the key names in the objects that are being deconstructed would be very helpful.

Also, it was not clear to me that I didn't have to account for unused object keys in my deconstructor like you have to do with arrays. I think just a little more clarity on this would be worthwhile even if it lengthens the reading a bit.

Typos/errors in test. Solution already in index.js

  • last test: song_2 is defined as the incorrect song
  • last const destructuring lines in index.js file should be:
    const { song_2, song_4} = k_muppet.k_album.the_muppet_movie
    const { k_color, k_job, k_partner } = k_muppet
  • solution already in index.js so students dont have to do any work on their own.

#staff

Misc improvements

In the section "Destructuring Assignment with Strings", the code snippet defines a variable which it doesn't end up using. This snippet would be more effective if it did utilize the variable it defines.

Here's the snippet, which defines dogsName on the first line and should but doesn't reference on the second line:

const dogsName = 'Sir Woody BarksALot'
const [title, firstName, lastName] = 'Sir Woody BarksALot'.split(' ')
console.log(title, firstName, lastName) // Sir Woody BarksALot

The same goes for the snippet immediately after.




Additionally, in index.js, step number 8 asks "Use destructuring to assign songs 2 and 4, and Kermit's job and partner" but the spec checks for these variables as well as color.

Running learn in WSL Terminal Error

I am using the WSL terminal when I run learn for the test suites. I receive this error:

Traceback (most recent call last):
11: from /home/jcobian/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in <main>' 10: from /home/jcobian/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in eval'
9: from /home/jcobian/.rvm/gems/ruby-2.6.1/bin/learn-test:23:in <main>' 8: from /home/jcobian/.rvm/gems/ruby-2.6.1/bin/learn-test:23:in load'
7: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/bin/learn-test:68:in <top (required)>' 6: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/runner.rb:20:in run'
5: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/runner.rb:20:in fork' 4: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/runner.rb:21:in block in run'
3: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/runner.rb:44:in report_and_clean' 2: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/reporter.rb:13:in report'
1: from /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/reporter.rb:47:in report' /home/jcobian/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/strategies/mocha.rb:42:in results': undefined method `[]' for nil:NilClass (NoMethodError)

It runs fine at first by this I mean it'll work then out of nowhere it gives me this error. This is not the first time I've into this issue, the first time I deleted the forked copy and re-forked. One of my cohort members than ran into the same issue and found a solution:

Run
rm -rf node_modules

Then run
npm install node

This worked the first couple of times after I kept running into this issue but now it's not working and I had to revert back to deleting the forked repo and forking it again.

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.