BitwiseHumans's profile picture. Principal Engineer | { Code. Scale. Ship. Repeat. }

Bitwise Codes

@BitwiseHumans

Principal Engineer | { Code. Scale. Ship. Repeat. }

Never underestimate the clarity of optional chaining in TypeScript. Instead of `user && user.address && user.address.city`, just write: user?.address?.city Clean, safe, and readable. Do you still see codebases stuck in the old pattern? Why? #TypeScript #JavaScript


When refactoring JS, I find `Array.reduce()` often leads to cleaner, more predictable results than loops—especially for composed transformations. const sum = arr.reduce((t, v) => t + v, 0) Do you reach for `reduce()`, or prefer maps + separate steps? #JavaScript #CodeQuality


Using `??` (nullish coalescing) in JS/TS is safer than `||` when handling 0 or empty strings. Example: let count = input ?? 0 Ever been caught off guard by `||` treating 0 or '' as false? How do you handle fallbacks? #JavaScript #TypeScript


Small habit, big win: I always prefer `Array.some()` over manual loops when just checking for existence. Feels cleaner and intention-revealing. const hasActive = users.some(u => u.active) What’s your go-to for these quick checks? #JavaScript #DevTips


Don’t sleep on object destructuring in JS—super clean for pulling props or configs: const { port, host } = config Way more readable than endless `config.something`. How do you keep your function signatures tidy? Share your approach! #JavaScript #CleanCode


Nullish coalescing (`??`) has saved me from too many unexpected `0` and `''` values slipping through. Unlike `||`, it only checks for `null` or `undefined`: const result = input ?? 'default'; Curious—do you reach for `??` often, or stick with `||`? #JavaScript #TypeScript


When handling config in Node.js, I prefer `process.env` + a schema validator (like zod or joi) over loading .env directly. Safer, and mistakes surface early. Anyone else tightly validate env vars? Or do you trust your config files? #NodeJS #TypeScript


Ever reach for `Array.map` when you really need `Array.forEach`? Remember: `map` returns a new array, `forEach` doesn’t. Different intent, different use. I see this mix-up often in reviews—do you? Share your go-to array method! #JavaScript #WebDev


Destructuring isn’t just for objects—you can skip elements in arrays too: const [, second, , fourth] = [10, 20, 30, 40] console.log(second, fourth) // 20 40 How often do you reach for array destructuring in your code? #JavaScript #CodeQuality


Using `??` (nullish coalescing) in TypeScript beats `||` when handling falsy but valid values like `0` or `''`. const value = input ?? defaultValue Ever been surprised by `||` swallowing legitimate data? Let's hear your stories! #TypeScript #JavaScript


Chasing a pesky bug? `console.log` is fine, but Node.js’s `util.inspect(obj, { depth: null })` shows deeply nested objects clearly. Saved me more than once. What’s your go-to debugging trick when things get tangled? #NodeJS #JavaScript 🐛


Nullish coalescing (`??`) is a game changer for handling defaults in JS/TS. It only kicks in for `null` or `undefined`, unlike `||` which treats `0` or `''` as falsey too. const count = value ?? 10 What edge case has bitten you here? #JavaScript #TypeScript


After years with JavaScript, I still double-check array mutations. For clarity, I prefer spreading: `const updated = [...arr, newItem]` over `arr.push(newItem)`. Immutable patterns reduce bugs long-term. How do you handle state updates? #JavaScript #WebDev


When destructuring in JavaScript, setting default values can prevent weird bugs: const { status = 'idle' } = config It’s a subtle way to make your code safer, especially with unpredictable inputs. How do you handle default values in your projects? #JavaScript #DevTips


Ever reach for `Array.from` instead of `map` to convert NodeLists or Sets in JavaScript? I find its flexibility underrated: Array.from(set, item => item.id) Which conversion trick do you use most often? Let's compare workflows! #JavaScript #WebDev


In TypeScript, I rarely use `any`—but when I do, it's always a deliberate choice for escape hatches, not a habit. Strong types catch bugs early! How strict are you with typing in your projects? #TypeScript #DevTips


When using TypeScript, `unknown` is safer than `any`—it forces you to do runtime checks before using a value. I reach for `unknown` when a function’s input can be anything and I want type safety without losing flexibility. Do you use it often? #TypeScript #DevTips


In TypeScript, prefer `unknown` over `any` for safer type checks—it forces you to verify a value’s shape before use. let input: unknown = getData(); // Type narrowing required before accessing properties How often do you reach for `unknown`? #TypeScript #DevTips


Sometimes the cleanest way to handle optional config in JS/TS is with destructuring and defaults: function setup({ port = 3000, debug = false } = {}) { // ... } Do you prefer this pattern, or explicit parameter checking? Curious what feels “right”! #JavaScript #TypeScript


The biggest TypeScript win? Catching accidental `undefined` returns. Enforce strict return types: function doThing(): string { // forgot a return! } TS instantly warns you—plain JS won't. Has strict typing saved you from sneaky bugs? #TypeScript #DevTips


This account does not have any followers

United States Trends

Loading...

Something went wrong.


Something went wrong.