switchon@lavalamp.biz
+27(0) 83 419 4851 / +27(0) 21 036 1165
Application & software development
Get A Quote

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact
    communication skills
    Why Communication Skills Is An Important Skill For Developers
    May 30, 2022
    ubuntu
    Help! I’ve Had To SSH Into A Linux Box (Part 2)
    Jun 13, 2022

    The Weird And Beautiful JavaScript Language

    Categories
    • Software Development
    • Web Development
    Tags
    • code
    • coding
    • javascript
    • js
    • programming
    development team
    development team

     

    As a full-stack developer I often look for ways to continuously improve my code, whether it be performance, optimization, readability or generally making my life easier. JavaScript has so many language features that allow you to experiment with so many different concept considering it’s used in both front-end and back-end frameworks.

    It is a dynamically typed language, which means variables are assigned a type at runtime based on their value. Much like other dynamically typed languages, this opens up a great deal of possibilities to what you can do with data manipulation in your code.

    This article highlight some of these language features which fall into 3 categories:

    1. Make your life easier (W)
    2. Beautiful (B)
    3. Weird (L)

     

    Make your life easier (W)

     

    Unique array records (W)

    A Set is JavaScript object that is used to create a record of unique values. This is useful if you want filter out duplicates (whatever the type) in an array object.

    Quick type conversions (W)

    As mentioned above, JS is a dynamically typed language which makes type conversion, although strange, but very easy and kind of wonderful

    Array/Object manipulation (W)

    Having to work with objects of data, not just in JS  but other languages. Often times to find yourself having to loop of these objects, nest some of those loops with some conditions. While some of these object manipulation tricks are popular and familiar in JS, here’s a few unpopular ones I’ve found to be very nifty.

    Spread Syntax

     

    Beautiful (B)

     

    ES2020 language features (B)

    BigInt

    A special JS numeric type that provides support for integers of arbitrary length.

    Nullish Coallesce

    Allows us to truly and correctly check for nullish values (null, undefined) instead of falsey values.

    Optional chaining

    Optional chaining allows us to access deeply nested object properties without worrying if the properties exist or not. This is useful especially if you’re not sure what the data looks like or it does not have a consistent structure.

    globalThis

    A this object that always refers to the global object, no matter where you are in you code scope.

    Promise.allSettled()

    Unlike Promise.all() which resolves only when all promises passed to it resolve else rejects with the first rejected promise error, Promise.allSettled always get resolved with an array having info about all the promises passed to it, whether resolved or rejected.

    Dynamic Import

    Used to import JS files dynamically as JS modules in your code

    Some/many of this ES2020 may not be compatible with older browser/JS environments. Enter BabelJS. BabelJS is a JS compiler that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments. Here’s an example of babel at work (from babel docs)

     

    Weird (L)

     

    The Weird Stuff (L)

    As mention, JS a is dynamically typed language. So this opens up a room for a lot error when it comes types and their interpretation.
    Hers’s a few honorable mentions that make JS what many would define as annoying but I just find hilarious and very quirky.

    You can find more of these on denysdovhan/wtfjs.

    Conclusion

    I have not been heavily involved in front-end development lately and so many thing mentioned above may not be entirely correct/accurate anymore. If you do spot something that may have changed or forgot to mention, please highlight it in a comment below.

    Contact us


      Related posts:

      errors in app insightsUnhandled Promises Sent Through To App Insights In Node JS dynamic doughnut graph using laravel vue componentDynamic Doughnut Graph Using Laravel Vue Component sending files with auxiliary dataSimple Way To Send A File With Auxiliary Data Via Axios In VueJS javascript basicsJavaScript Basics
      Share
      0
      Roger Ndaba
      Roger Ndaba
      Roger is a curious Software Engineer who just loves writing code.

      Leave a Reply Cancel reply

      Your email address will not be published. Required fields are marked *

      Lava Lamp Lab


      Like technology, a lava lamp constantly changes form, producing new conditions with every passing moment



      lava lamp lab facebook   lava lamp lab twitter   lava lamp lab linkedin   lava lamp lab instgram

      Services


      Application & software development

      Outsourced software development

      Project based resourcing

      Digital marketing & consulting

      Graphic design & consulting

      UI / UX design & consulting

      Contact Us


      +27(0) 83 419 4851

      +27(0) 21 036 1165


      switchon@lavalamp.biz


      Unit 4 Monaco Square,
      14 Church Street,
      Durbanville,
      Cape Town, 7550

      NBConsult Group


      nbconsult
      nbconnect msp
      nbclearning
      river broadband
      designer needed
      © 2022 Lava Lamp Lab (Pty) Ltd | All Rights Reserved | Privacy Policy
      Contact us now

        Application & software development

          Outsourced software development

            Project based resourcing

              Digital marketing & consulting

                Graphic design & consulting

                  UI/UX design & consulting

                    Lease an expert

                      Recruitment services

                        We are using cookies to give you the best experience on our website.

                        You can find out more about which cookies we are using or switch them off in settings.

                        Lava Lamp Lab
                        Powered by  GDPR Cookie Compliance
                        Privacy Overview

                        This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

                        Strictly Necessary Cookies

                        Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

                        If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

                        3rd Party Cookies

                        This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.

                        Keeping this cookie enabled helps us to improve our website.

                        Please enable Strictly Necessary Cookies first so that we can save your preferences!

                        Cookie Policy

                        More information about our Cookie Policy