• Profile picture of Vince the Animator

    Vince the Animator 2022-10-31 01:03:46 UTC

    For some reason bitwise operators kinda “clicked” for me just now, so I was going off on some weird ass tangent to figure out how to populate the stickfigure class with default values for missing data using bitwise operators to save a few bytes of memory and look smart by using overly complicated syntax,

    but then I remembered that there’s a different pattern that doesn’t use any variables, is more concise, and still makes me look smart with slightly less complicated (but subjectively still overly complicated) syntax (using the ternary operator):

    I can now pass the Stickfigure constructor an object of any available data when instantiating it, and any missing data will be filled in with default values.

    yes, that’s all the code I’ve written so far today xd

    9