Questions about lines between cheating and research

So the .map example in this challenge does not show how to add object literals and more than one object literal in the map function. After reading MDN docs, it still never showed me until I googled “how to return objects .map”. I came to a website which gives an example on how to use it with object literals which is required within the challenge. Here is the example on that website (with link to the page):

const numbers = [2, 3, 4];
const squares = numbers.map(n => { return {result: n**2} });

I used this example to create the code below, so my question is if that is considered cheating, because I know you are encouraged to research solutions but this example I found wouldn’t be that easy to describe in words. I also figured out how to add the second property in the objects I was returning on my own. This is what I found and the challenge guide does not have anything alluding to returning object literals. Maybe I am overthinking but I had no clue or hint that I could even use a return statement in my map function lol.


// Only change code below this line


let ratings = watchList.map(rating => {return {title:rating.Title,rating:rating.imdbRating}})

// Only change code above this line

console.log(JSON.stringify(ratings));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36.

Challenge: Use the map Method to Extract Data from an Array

Link to the challenge:

If you copy and paste that code and move on, that’s piracy and plagiarism and a bad thing.

Instead, you did valid research, looked at what was presented, and then synthesized and extended that research, in adding additional properties. At a guess, you may have had to deconstruct a little, to understand what was going on, but you researched and applied that knowledge in a new way.

That, to my mind, is the difference. I will often give examples of code that’s close but not the same, in the hope that the student still take my example, deconstruct it, and build a solution of their own on that foundation. As you, in fact, seem to have done.

3 Likes

I appreciate the breakdown of the though processes. That is exactly how I did it, and researching is something I enjoy doing but I always try to source information from FCC before I look at anything on the web. As you may know, some people post solutions on accident in the forum and I have just stopped looking at code altogether just the literal breakdowns people provide about the code. If I were to accidentally glance at an answer, it makes it even harder for me because I don’t want to use any of the code I saw with my eyes, so I look for another way to solve it. But as you explained, I can look at the code with my eyes and see what is happening and apply the same theories without copy and pasting. Research is obviously important in learning or applying this stuff, so thank you for clarifying the lines in between!

1 Like