Thomas Maddocks 🇬🇧 (@ThomasMaddocks) header
Thomas Maddocks 🇬🇧 (@ThomasMaddocks) profile picture

👨🏻‍💻 Senior Front End Developer / Enthusiast. Often seen tweeting about #JavaScript, #TypeScript, #Angular, #React and any words of wisdom I have to offer 🦉

UK
Joined November 2015
Photo by Thomas Maddocks 🇬🇧 (@ThomasMaddocks)Photo by Thomas Maddocks 🇬🇧 (@ThomasMaddocks)Photo by Thomas Maddocks 🇬🇧 (@ThomasMaddocks)Photo by Thomas Maddocks 🇬🇧 (@ThomasMaddocks)
Thomas Maddocks 🇬🇧 retweeted
Replying to @telmo
I'd arrange and put the happy path last, and all the errors first: func getUser() { if (!user) { return "nada..." } return user } I think, this way the code is much easier to read and you can easily see the exception conditions "intended" to the right.
10
11
213
Thomas Maddocks 🇬🇧 retweeted
It's interesting that jQuery still comes up as a requirement these days. It's pretty outdated. If you need it for this particular job, of course, you need to invest some time learning it - but I wouldn't spend too much time on jQuery in general.
1
1
1
🤕nested ternaries: just because u can doesn’t mean u should 🛑 the ternary operator is useful, but nested ternaries are a horror 🧛‍♂️ to read 👇 (condition) ? truthy : (condition) ? truthy : falsy; #100DaysOfCode #CodeNewbie #freeCodeCamp #javascript
8
21
Thomas Maddocks 🇬🇧 retweeted
Really surprise to see that I could redeclare let in the chrome console. However, nothing has changed, just how you explain it. Don't think you are going to open the console and demonstrate, as it's going to surprise and confuse two of you. #JavaScript #ES6 #ECMAScript #webdev
1
2
3
Thomas Maddocks 🇬🇧 retweeted
🔥Tip: Use optional chaining with TypeScript 3.7 instead of checking every value for null or undefined. #JavaScript #TypeScript
3
6
Thomas Maddocks 🇬🇧 retweeted
#javascript tips 🧙🧙‍♂️: Promise.any in ES2020! Promise.any gives you a signal as soon as one of the promises fulfills #javascript30 #typescript #angular #vue #react #100DaysOfCode #CodeNewbie
4
48
115
Thomas Maddocks 🇬🇧 retweeted
🔥#JavaScript Tip of the Day With #ES2020 we can import libraries using async/await on demand. Utilization of needed resource. RT and follow if you like 🙏 #100DaysOfCode #WomenWhoCode #typescript #javascript #reactjs #vuejs #Angular #altcampus #freeCodeCamp #Nodejs #Tips #code
1
36
1
66
Thomas Maddocks 🇬🇧 retweeted
✨#RxJS Lessons✨ Creation - of() Although they aren't strictly operators, we'll begin with Observable creation. of(values) emits each argument it receives and completes. To access the values our Observable emits, we have to subscribe. #100DaysOfCode #CodeNewbie #Typescript
6
55
211
Thomas Maddocks 🇬🇧 retweeted
optional?.chaining?.in?.javascript?.[2020] really?.cool?.feature?.(▶️) youtube.com/watch?v=jdU5X3GJ…
19
80
10
435
Thomas Maddocks 🇬🇧 retweeted
#JavaScript tips🧙‍♂️🧙: Add CSS to console.log. You can use %c to declare CSS rules in your console.log 🖌️🎨 #Typescript #codenewbie #100daysofcode #angular #vue #react
9
141
5
464
Thomas Maddocks 🇬🇧 retweeted
JS TIP - > Here is a quick tip on how to merge 2 objects together in js. Using the es6 spread operator you can easily merge these 2 objects together. #100DaysOfCode #javascript
4
19
52
Thomas Maddocks 🇬🇧 retweeted
Javascript Array methods cheat sheet part - 1 1 - push( ) - insert an element at the end. 2 - pop( ) - remove an element at the end. 3 - unshift( ) - insert the element in the beginning. 4 - shift( ) - remove the first element. #100DaysOfCode #javascript #programming
9
120
2
397
Thomas Maddocks 🇬🇧 retweeted
Javascript array method cheat sheet part - 3 1. flat( ) - This is a really cool feature and it helps get away from extra loop and lines to make a flat array. #100DaysOfCode #javascript
3
23
66
Thomas Maddocks 🇬🇧 retweeted
Functional programming is a style of coding where you avoid state changes & focus on mathematical functions & primitives like map & reduce. I really like it cuz it's often shorter, less error-prone & can avoid introducing more variables. #100DaysOfCode #javascript
13
46
Thomas Maddocks 🇬🇧 retweeted
Did you know you can create "disposable" even listeners that will trigger only once? Simply use the "once" option! Try it here: codesandbox.io/s/once-listen… #100DaysOfCode #programming #javascript #code
16
170
11
624
Thomas Maddocks 🇬🇧 retweeted
Why I no longer write classes in #Javascript: I don't need them. Instead, I use: 1. Plain objects (data only, no behavior) 2. Pure functions (no side-effects, no outside dependencies) Easy to test. ✅ Easy to understand. 🧠 Easy to compose. 🏘
58
266
35
1,690
Thomas Maddocks 🇬🇧 retweeted
If you need to log a DOM element in the console, consider using `console.dir` rather than `console.log`. This way you will get the list of properties as if it were a normal object instead of the element. #100DaysOfCode #javascript
4
70
2
225
Thomas Maddocks 🇬🇧 retweeted
#JavaScript tip for today: `some` & `every` are one of the most underutilized array methods. So don't just `filter` everything. Recognize when what you are asking is a "yes/no" question and often these will be the methods you need for a more elegant solution.
22
305
8
1,235
Thomas Maddocks 🇬🇧 retweeted
#RxJS ✨Tips 'n Tricks✨ Marble Testing is an awesome way to test asynchronous RxJS code. However, representing time with - can get a little tiring. 🔥Time progression syntax to the rescue🔥 Take a look at the before and after: #javascript #100DaysOfCode #typescript
1
45
66