![]() But the more advanced the concept, the harder it is going to be to absorb. The first lessons are easy enough to absorb right away. You would learn less if FCC spoon fed you everything.īut I guess making a mistake is a process that should be. As a professional programmer, on a good day, I only have to google things or consult the docs 20 times a day. You are expected to do side research about things that confuse you. …but my javascript learning process doesn’t move as fast as html / css, which makes me think there’s something missing. ![]() ![]() Not a lot of people can do what we do because it is hard to learn and takes a long time. I call it “job security” - if this were easy it would pay minimum wage. If you can’t do it, go back and do it again. Keep reading books and doing tutorials, but do it in parallel with actually building things.Īctually, being unable to complete the JavaScript directives, which are explained simply, makes me pessimistic. But once you have a basic knowledge, I think this is important. You will make mistakes and learn from them. Just start building things and you’ll run into problems and have to research things. They help you get ready but the real learning is when you jump in the pool and struggle. Books and tutorials aren’t the same as coding. My point is that you could read all the books you want and all the youtube videos but the real learning is when you get in the pool and struggle. I always say, “you can’t learn to swim without swallowing a little pool water”. But they can be good practice and interviews often use these types of problems for interview, sometimes even using sites like these.Īnother thing I would suggest is to start building crap. Keep in mind that some of these have poorly written challenges and people with attitudes there. There are also plenty of web sites with algorithm challenges, like Code Wars, etc. I believe the solutions are in Java, but you can probably tell what’s going on and there are people that have published JS solutions online if you look. It deals with a lot of ideas about interviewing, but the meat of it is algorithm challenges. I would also throw in Cracking the Coding Interview. I agree with a lot of the suggestions here. I’m not saying learning Java is a bad idea, just that if you are still learning JavaScript, it may not be the best idea. The issue with this code is that modifying an array while iterating over it.So first of all, Java and JavaScript are different languages, right? They have some similarities because they both descend from C, but they are very different languages. However, in this case, the loop for (let i of arr) directly iterates over the original array arr. In this snippet, the reverseArrayInPlace function also attempts to reverse the elements of the array using the same approach. Let arr = function reverseArrayInPlace(arr) reverseArrayInPlace(arr) console.log(arr) //result=> The answer to my previous question is simple: You can use a local binding to briefly hold on to one of the elements, overwrite that one with its mirror image, and then put the value from the local binding in the place where the mirror image used to be. You can do this by looping over half the length of the array (use Math.floor to round down - you don’t need to touch the middle element in an array with an odd number of elements) and swapping the element at position i with the one at position array.length - 1 - i. The trick is to swap the first and last elements, then the second and second-to-last, and so on. Using reverseArray or otherwise copying the whole array ( array.slice(0) is a good way to copy an array) works but is cheating. You have to be careful not to overwrite elements that you will later need. Iterating over an array backward requires a (somewhat awkward) for specification like (let i = array.length - 1 i >= 0 i-). The second is to loop over the input array backwards and use the push method. The first is to simply go over the input array from front to back and use the unshift method on the new array to insert each element at its start. There are two obvious ways to implement reverseArray.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |