I am now 70% of the way complete for my JavaScript course.

The thought came to me last night about am I focusing to much on training and not enough on doing?  Of course I am going to finish the course but should I be focusing on my projects as much as my training?

Doing a quick search I found the following:
In general, it is recommended to use both approaches when learning programming. Completing a course can help you build a strong foundation, while working on a project can help you apply the concepts you have learned in a practical way. This can help you become a better programmer and improve your skills over time.

 

 

Nothing like a good vague statement 🙄 to help out.  I think that I will continue on building my foundation and then move to a balanced approach of design and learning.  I already have a new course picked out that I want to start learning next but I don’t want to fall into the trap of always perfecting but never completing.

To ensure this, if I am not finished with this course in two weeks I will schedule to a 50/50 plan of project and learning.

As my journey to build my project continues and taking me down the road of learning Django and Javascript it continues to show and support my knowledge of “The one thing I do know is there is a lot that I don’t know”.  Not that I need a reminder as if I ever get to the point of think that I know everything or I know enough, that is the day that I think that I will be read to head for the long sleep.

I made good progress in completing the “The Complete JavaScript Course 2023: From Zero to Expert!“:
:

  • Section 3: JavaScript Fundamentals – Part 2
    • Lots of array and loops overview
  • Section 4: How to Navigate This Course
    • This was nice from the stand-point that there different routes that the instructor gives.  I am trying to learn everything so I will complete it all but there were paths if you just wanted to focus on how JavaScript works, just code, etc…
  • Section 5: Developer Skills & Editor Setup
    • Wow there is a rabbit hole of plugins for Visual Code

I am now current 20% into my JavaScript course and the is a lot to remember and there are a ton of different way to make something work. So the foundation is being laid but the next steps are to review html/CSS with is just a recap as I have a foundation of these already.  With focus I will get through the following sections today:

  • Section 6: HTML & CSS Crash Course
  • Section 7: JavaScript in the Browser: DOM and Events Fundamentals
    • I had do some learning already on this due to my Youtube form tutorial in which I learned how DOM (Document Object Model) works to follow a path to find a typo..
  • Section 8: How Java Script Works Behind the Scenes
    • I don’t think that I will get through all of this section but at least get a good amount completed.

So I am sure if someone ever reads this blog, they will think that I am a bit all over the place with my learning, but there is a method to my madness 😉. As I was doing forms for my Django forms, I found that I was learning a lot but there were things that were escaping me. Could I make a form and make my site work? Yes.  Could I truly say that I knew what I was doing, sadly, No.

So I called in the big guns… I talked to my son-in-law (graduated top of his class from University), my daughter has 10 credits to finish her Software engineering degree (She also has a BS in Asian Studies), my son who has bootcamp in certificate for DJango and Python but pivoted on that knowledge and is working as a Junior Software engineer using C#, after completing an internship and was hired fulltime at an insurance company and now has just over a year done with his degree… So I have a pretty good team that I can ask questions to and a family that this dad is proud of 😊.

The challenge was, “Which version of Javascript should I use?”

This started a discussion about the some different versions and ultimately I decided on focusing on React JS. So I turned to the #1 place to learn… YouTube.

I found a channel that looked promising and going through the first thee lessons but again that feeling of, I am completing Yes, but am I fully understanding? No came back.

So number 2 place that I go when I want to learn something “Udemy”.  <sarcam>And luckly they were having a sale, that never happens. </sarcasm> 😉.

I found two courses that intrested me has I was focused on JS.

  • The Complete JavaScript Course 2023: From Zero to Expert!

  • JavaScript – The Complete Guide 2023 (Beginner + Advanced)

I decided to go with the one that had the a little better rating and more reviews.  I think that either one would have worked well.

 

 

That brings us to Coercion.  In section 2 – Lesson 20 the instructor (Jonas Schmedtmann) states that coercion can make code easier to read without converting everything, but there are others that state that you should convert everything as unless fully understanding coercion the input can cause unexpected bugs. The following example is given:

console.log(2 + 3 + 4 + ‘5’ + 6);

“+” works left to right and since the first three are number type it performs addition but the last value is a string so ‘2+3+4=9 is converted to a string and the values are concatenated and any other additional value will be a string.

I continued this and played with the following which confused me at first as I read it as:

console.log(2 + 3 + 4 + ‘5’ + 6 – 7); = 949

I was reading it at (2+3+4) (‘5’+6) concentrate 7 and was expecting 9567 when the value came out as 949.  Say WHAT?!?!  AI to the rescue… right?

 

 

ME: “how does console.log(2 + 3 + 4 + ‘5’ + 6 – 7); equal 949 in javascript”

AI:

The expression console.log(2 + 3 + 4 + '5' + 6 - 7) is evaluated as follows:

  • First, the numbers 23, and 4 are added together to get 9.
  • Then, the string '5' is concatenated with the number 9 to get '59'.
  • Next, the number 6 is added to '59', which is converted to a number because of the addition operator. This results in the number 65.
  • Finally, the number 7 is subtracted from 65, resulting in the final value of 58.

Therefore, the expression evaluates to 58, not 949

ME after understanding that numbers and string can be converted back and forth: 
This is incorrect information. After the concatenation in step 2 the value is now considered a string so when + 6 is evaluated, + 6 is considered a string and it makes the value of 956 not 58.

AI: 
You are correct. I apologize for the confusion. The expression console.log(2 + 3 + 4 + '5' + 6 - 7) is evaluated as follows:

  • First, the numbers 23, and 4 are added together to get 9.
  • Then, the string '5' is concatenated with the number 9 to get '59'.
  • Next, the number 6 is added to '59', which is converted to a number because of the addition operator. This results in the number 65.
  • Finally, the number 7 is subtracted from 65, resulting in the final value of 58.

Therefore, the expression evaluates to 58, not 94912

Thank you for bringing this to my attention3

ME: You reponse is still incorrect

AI: 
You are correct. I apologize for the confusion. The expression console.log(2 + 3 + 4 + '5' + 6 - 7) is evaluated as follows:

  • First, the numbers 23, and 4 are added together to get 9.
  • Then, the string '5' is concatenated with the number 9 to get '95'.
  • Next, the number 6 is added to '95', which is converted to a string because of the concatenation operator. This results in the string '956'.
  • Finally, the number 7 is subtracted from 956, resulting in the final value of 949.

Therefore, the expression evaluates to 94912

Thank you for bringing this to my attention3

 

 

So two lessons learned coercion converts to the next operator and don’t blindly trust A.I. (I already knew this one…)

And as of now, I am leaning toward converting and not relying on coercing.