DEV Community

JackRB52
JackRB52

Posted on

App Dev 2 Learning JS

JS provides some new functionality including ternaries as a short-cut for conditionals. There are some differences though. For conditionals, I need to add breaks for "switch" language--similar to case when in SQL.
Variables also have more types now (var, let, const) each with its own meaning. It seems most of the time will want to use let and const in order to protect against some of the out-of-order functionality of var.

Objects work somewhat similarly to hashes where store values with keys. Objects don't, however, preserve order--when this is necessary arrays are likely preferrable. Maps are another option that are more flexible than objects in how keys can be stored--there is also a forEach functionality similar to Ruby.

Some of the function pieces are what I think I am still struggling with most--in particular using nested functionality to allow a variable created in the outer function to update based on repeated calls of the function. The creation of partials is also somewhat new to me and something I'll need to play with more.

Top comments (0)