That isn't true Rasmus. const will behave like so: if (true) const x = 5; console.log (x);//5 While let would behave differently: if (true) let x = 5; console.log (x)//Block-scoped declaration
@funfunfunction, Hi sir With all due respect I believe that var, let, and const all have a time and a place. To say that var is no longer used, let should take its place, and const should be everywhere I simply disagree. Yes let should be used for block scoping but I really have to say that const is being overused. If you want your object/code to not change, simply think a bit more about the outcome of your code ahead of time to prevent unforseen errors or even worse coding yourself into a corner. And also, as my professor says const should be something you know will never change, for example PI, gravitational acceleration, Euler's constant etc... In other words, use it when you know variables will never change, dont just assume its better than var. That is all, thank you~
@Midas / XIV what he said is not the actual thing happening at all. Your code will not be moved to top. This behavior is due to something called execution context. It has 2 stages, creation stage and execution stage. Since JS interpreter is single threaded, it needs to have a execution stack in order to keep track of what is being executed and a execution context is created for global and each function it executes. While in the creation stage, it will create global object, determine the value of "this" and also it will scan through the code and put variable declarations and functions to the memory. So when the execution stage comes, those declared variables (not their values) and functions are already available in the memory. Hence it feels like those declarations are moved to the top of the code.
Tip for the arm/hand pain: Do hand exercises! Do a RU-vid search for 'gaming hand exercise' and you'll find what you need. Just do this every 30-60 minutes for a couple of minutes... you'll notice a world of difference! Thank you for the video. As always, great content!
Good stuff. Immutability is really key to taking advantages of higher level programming languages that can parallel process your code without explicitly defining how the parallel processing occurs. This is why functional programming languages such as Scala, Clojure, etc. are gaining traction. I've been using JavaScript for 20 years and several of your JavaScript-centric episodes teach me something new about how things work "under the hood". Thanks mpj.
First off of course... thanks so much for your great videos! I really enjoy them. Programmers are getting this now but historically this was a condition that pianists got. This has been topic of conversation for pianists for since the first piano was built. Some of the advice is to have your arm parallel to the floor and to keep your wrist straight (so as to not cut off blood or restrict the nerves) an d to let the weight of your arm or hand coming down (ie gravity) is what provides the force to hit the keys not forcing the arm down. Lots of books on piano technique out there that all programmers should look at.
I had bad wrist pains from long days at the computer. I cured it by adding dumbbell wrist curls and reverse wrist curls to my workouts. 4 sets of 12 reps with light weights, 3 times a week. I also use gel keyboard and mouse wrist rests to try to keep my wrists in the same plane as my forearm. I’ve been wrist pain free for several years. Now would be a good time to also add some preventive shoulder exercises because that is another very bad consequence of too much desk work.
Love your videos as always! I had some arm pain after starting my desk job - mostly in the forearm, and a little tingling around the ring finger. My solution was to make sure my chair was high enough that my arms were 90 degrees with my keyboard, and get a stand for my laptop so I wasn't looking down at it. The source of the problem was actually tight muscles up around my shoulders and neck, which resulted in a nerve being pinched. A little ointment on my shoulder when I found it getting tight helped too. It took a couple months but did get back to normal.
Another arm pain tip: In addition to posture and exercises, if you use a mouse, train your opposite hand so you can switch and give each hand/forearm a break. The first week of using the opposite hand was quite challenging for me. I became both physically and mentally tired quickly. But after the first week my accuracy and stamina was good enough for non-pixel perfect use.
impressive... very smart, no keyboard strok sound, no nasty backgroud sounds, theroy plus practical, deep knowledge so deep explaination ....amazing video !
Hey just wanted to say thanks. I am a 3 years into Java development, was trained in one of the software development bootcamps and learned ruby. As JavaScript is taking over the world my knowledge about it was very basic, and your tutorials makes me interested to apply more of these principles. I do find your videos very engaging, very informative, clear and concise. Thank you.
Great video sir! in terms of ergonomics: i used to experience what you described on a daily basis previously. What fixed it for my was: Have a chair which has a good straight sit mode (not hanging back nor too forwards) and make sure that your chair has armrests where your elbow can rest at height of about 2/3cm lower than your desk height. Also what is essential is using a mouse that suits your hand. It would shock you to know how many people use too small mice. A nice long mouse ergonomics wise is the Razer Deathadder. Again thanks for making these awsome video's for new aspiring JS devs and i hope your arm is okay again by now!
If anyone else is interested, this is the one I bought: www.amazon.de/Delux-M618-Scroll-Rad-PC-Maus-2-Wege/dp/B00AYXUIO6 It seems that this very model is sold unter a bunch of different names, seems to be the same mouse though.
you really don't need it though, at least not initally depending on your injury. most rsi comes over time (obviously.) so most is fixed by improving your wrists/arm/shoulder movements. powerball, stretches, nerve glide exercises. a vertical mouse aliviates the symptoms, it doesn't prevent them. :)
For ergonomy - and this is something that has helped me immensely - you should look into compact mechanical keyboards. - Short distance between mouse and keyboard - Shortcuts for moving the cursors (stay in the home row) - Better typing feedback = less mistakes, more precision and less typing I'd recommend a Pok3r keyboard with brown switches or, for an endgame, comfortable keyboard, the Happy Hacking Keyboard Pro 2. Touchpad instead of mouse is pretty nice too, it helps in keeping the hand flatter instead of "claw-shaped" and avoids wrist movement.
Hi MPJ Use your mouse with your left hand for a while. You get used to it after a bit. Also get a pad to lift up the base of your palm so your hand is parallel with your forearm, ie your wrist isn't bent backwards at all. Or have a high platform to use your mouse on which also stops your wrist getting bent. The only rear cure for RSI (repetitive strain injury) or Carpal Tunnel is rest. Turmeric is a good natural remedy for inflammation.
Just discovered you today and can't stop watching. Great content and humor! Concerning arm pain: I had this and it was due to clicking on mouse buttons. Makes sense that extending a finger and mashing a button hundreds of times a day would cause RSI. Problem went away quickly and has stayed away for years when I replaced the mouse with, first, a Wacom tablet and later a magic track pad with tap to click enabled.
I trained my left hand to be as efficient as my right hand using the mouse. It was annoying for the first week or two but you will appreciate being able too switch back and forth when one gets too painful. Its always good to have a backup. Thanks for the awesome vid's by the way!
For the arm pain... I know people who said they had the same issue but switched keyboard styles to an alternative to qwerty and that fixed it for them. Also, I know you prefer very simple text editors, but a nice perk to vim is that your hands stay on home row during everything you do, so that you don't have to move your hands down to the arrow keys and Control keys as much
Tips on dealing with arm pain (I'm not a doctor, just telling what I do since I had bad pain): 1) Workout - Sorry dev fellas but the body need some exercise. 2) Stretching - From time to time stop and do some streching (something like this: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Ub0UQpPzttc.html). 3) Trick your brain and try to use the mouse with the other hand. This is funny but you get used. 4) Make sure you have enough space at the table to support your forearm when you are typing and using the mouse. Cheers
An ergonomic mouse from Amazon is great and you can find them for around 20$, also you can give yourself a self-deep tissue massage by putting strong pressure on the places in your arm where you feel pain. If you feel a crunch, then try to breathe through the pain and work it out. If it's in your hand it's probably originating in the shoulder or even the chest or back. You don't want to hurt the other hand by over-exerting it on the pressure, so I push my body against the source of the pain on a chair arm, corner of a wall, or the pole of the subway car when I'm going to work.
I've been looking at ergonomics for a little while, and while I'm not an expert and definitely not a doctor (seriously, if you have any sort of regular pain; arm, wrist, legs, back, whatever; go see a doctor.) and lot of what's out there is speculation and hypothesis, but here's what I've learned. Step 1 is posture. I'm currently reading Deskbound (by Kelly Starrett) and the general theme is DON'T SIT! If possible, a standing desk with good posture should be more comfortable and better for you in the long run. If you need to sit, try an alternative to a chair such as a large ball (this will strengthen the core and align the spine naturally). REALLY need a chair? Make sure you're posture is tip-top, no slouching and no arching, and get up and move regularly (~every 15 mins). Desk height is also key, all the normal stuff. Keep the top of monitor at eye height, and the arms should be relaxed at 90 degrees, elbows just resting on the desk without lifting the shoulders. Don't use a wrist-rest! The weight of your forearm on your wrist, even padded, could exacerbate carpel tunnel issues more than help them! Weight should be spread as even as possible along the length of your arm. The mouse hand can pivot nicely from either the bony part of the wrist (pinkie side of the carpel tunnel) or the elbow. Speaking of mice, input devices! Vertical mice seem promising but I must say I'm not totally convinced (arms neutral, my palms rotate to point up, not inward or down). However, regular mice and touch-pads are known to be awful for wrist injuries. Everybody is different so if you know one mouse input gives you grief, try another (e.g. graphics tablets are a good option). One thing I've heard is to cycle through the input methods you have throughout the day. Keyboards are also an issue, for me in particular. A regular keyboard has my wrists in almost constant ulnar deviation (palms down, rotating outwards towards the pinkie) which gets very uncomfortable by the end of the day. A split/ergonomic keyboard should fix this (in theory) so I'm looking to get one asap. Hope this helps someone!
Posture is the part they call static load. The second is repetitive action. What +funfunfunction describes sounds more like something that happens from continuous typing, or usage of the mouse. As you've pointed out - doctors are best (they can give you sick leave etc...)
Exercising daily and taking breaks often is the only thing that works for me. It doesn't have to be anything special, just some 5 min of body-weight exercises. Don't forget to work on your core. Use handles for pushups if you're having wrist pain. And don't overdo it! It's better to do 5-8 pushups every morning and evening than to do 20 at once and then not be able to train at all the next day.
I have a degree in Sports Forearm issue: inflamed muscles &&|| tendons Reason: Pronation of the hand while using the mouse and typing Forearm pain: 1. Mouse: Try a larger(as in taller) one that permits a more claw like grip, this will make your hand rotate to a more neutral position => opposite of apple mouse, that's horrible 2. Self-massage 3. Stretching (try and find the angle where it hurts) 3.0 Steps (I think for starters twice a day will yield results, you will figure out for yourself if you need more or less) 3.1 Warm-up your forearm (movement with no pain) 3.2 Light stretch (some pain is allowed) 3.3 Gain mobility / Hard Stretch 3.4 Don't go crazy on it, after several minutes you shouldn't feel more acute pain than before 4+ There are some more techniques but the forearm being such a small muscle group they wouldn't help too much General muscle pain 1. Eat enough proteins 2. Try and not underdo too much the basics - Hydration - Sleep - Some vegetables in the diet Great vids btw
On the subject of arm pain: Place the mouse on the left hand side of the keyboard - this works by 1) spreading the workload between the hands (only slightly, if you're a terminal-minded person like me, but still) and 2) decreasing the distance you move your hand to reach the mouse (since normal keyboards are asymmetrical and stick out further to your right - with arrow keys, and numerical part). Also, make sure you arms are supported by your desk (don't hold them up by muscle force), and that your wrists are not bent (usually this entails putting your keyboard flat on the desktop surface and not folding out those small legs most keyboards have).
Man, I am currently on 7:08 and have learned more than with hundreds of articles on the web. Thank you very much, seriously. JS looks crazy for square guys like me haha
Nice video! That was a great little explanation on those concepts. I now credit you with convincing me to start using let until I am wise enough to know when to use const.
Hand / arm issues related to long hours smashing your keyboard can be relived with the help of stretches and tender loving care. 1. Stretch and do it often. Extend your arm straight out in front of you. Palm facing away from your chest and fingers pointed away from your feet. Take your other hand and apply pressure to your fingers so they are bend back toward your wrist. You can also reverse this by bending your hand and fingers downward. Do not over extend, listen to your body. 2. Place hand / arm in warm water for 3 -5 minutes. After massage the muscles with you opposite hand. 3. Take any anti inflammatory drug. (aspirin, ibuprofen) Not recommended for constant use. Haha get it, constant?... 4. Take time away from your computer and change your working set-up. I personally use thumb controlled mouses. The ones with the ball and all you do is move your thumb to move the mouse cursor around.. anyone else use em? Helps wonders.
const notes = { video: { ref: "Variable Types", src: "ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sjyJBL5fkp8.html", v: "Javascript ECM5 - check differenced to current ECM version (6)", content: { Scopes: { block: "if, for, etc", function: "within the function", global: "whole file [NEED TO CHECK]", exported: "entire project [NEED TO CHECK]" }, "variable types' scopes": { "no type": "automatically declared as global variable", var: "function scope", let: "block scope", "const": "block scope" }, hoisted: "variabls are 'hoisted' in JS. Declarations are automatically moved to the top of their respective scopes.", "use strict": "prevents undeclared variables to be promoted to global scope. Always use 'use scrict'", "mutable states": "VERY important to minimize this as this can be the source of applications stalling/hanging. Minimize it by using 'const' variable type every time you dont specifically need a type:let variable. If you dont need to redeclare it, use const. Important." } } }
I was also having arm pain a couple years back, and what greatly helped me was learning to use a Kinesis Advantage keyboard along with a trackball mouse. The Advantage has the keys in a columnar layout and shaped like a bowl so your fingers don't have to travel as much. It took me a good week before I felt comfortable using it but now I can't stand any keyboard that isn't columnar.
For your arm pain....get a yo-yo and make sure you use it properly by holding the yo-yo in your palm and throwing the yoyo down by facing your palm to the sky and rolling the yoyo out of your hand by extending and stretching your wrist backwards and rolling the yoyo off the end of your fingers. 15 years ago I thought I was being trolled by asking a reddit thread how to cure Carpal tunnel syndrome and was told by a russian programmer to get a yoyo. Once I learned the proper way to throw the yoyo, the pain subsided in 1 week after a doctor had just told me I would need surgery. I carry a yoyo with me in my backpack to this day and have never had the pain issues again!
I had the same arm pains along with something akin to tennis elbow. I got a vertical mouse and had to do a series of weekly massages before everything went back to normal. I now stretch my arm muscles several times per day and try to exercise them in other ways to keep them feeling fresh.
I had carpal tunnel surgery in January. Your symptoms sound very similar to mine. I had arm pain, wrist and hand pain, numbness and loss of strength. You should visit an orthopedic surgeon. They have tests that can verify if it's carpal tunnel syndrome. Recovery wasn't fun but definitely worth it.
Just found your videos. Are you still having arm pains? I was thiiiiis close to surgery before going all ergonomic setup. This included a ten-keyless keyboard (Kinesis Advantage 2 -- best keyboard I've ever owned), trackball, a keypad on the left side (Razer Orbweaver for shortcuts), etc. This COMPLETELY eliminated all arm pains, shooting electric shots up through the shoulder and spine, etc. Saved me tens of thousands in medical fees. Really enjoying the vids -- subscribed!
Thanks a lot for your great effort. It is really fun to watch. I love the role plays with different characters to see all the different angles. I have noticed the way you express your self with words that stress the reserve words you are explaining. It sparks my neurons and keep me focus. Interestingly I have watched a lot of your videos about the most complex subjects and such a basic thing as the proper use of const will increase the robutness of my code. I have been leaking so much unnecessary state in my code!!!! So I will go to basic.
First, great video. Second, wrist pain. I don't get wrist pain for the same reason, but I think I have a solution. I tore my left TFCC (cartilage in the wrist). Ever since, I've had problems with pain. I bought a Goldtouch V2 Adjustable Keyboard and it literally solved all my issues. It looks incredibly weird (I've never met anyone that hasn't commented on it) and takes some getting used to, but it feels incredible. My first one lasted about 6 years (I think it broke in a box while moving, so I don't think it even gave out), and I just bought my second one a few months ago. I honestly swear by it. Writing this makes me think I should write a review lol.
When he is making video 20 minutes length, you know you will watch it for one hour, not because of looking to understand problems and various situations, , but looking his facial expresions, movement, voices and shouts and constantly repeting them. Yes.
About pain in your primary arm, use trackball. With trackball, you basically have to move only your thumb, thus helps a lot. Logitech M540 is my personal favorite.
6:42 You’ll also have issues with lines starting with a bracket (e.g. an array destructuring assignment), a unary plus/minus operator (e.g. an expression that needs to be converted to a number but not stored for some reason?), though clearly the IIFE is the most common case. Basically, when you start a new line with a character that could also be part of the previous statement, start it with a semicolon instead because the JS engine will assume that you’re just breaking a single statement into several lines unless that really doesn’t make any sense. Also, here’s a pretty effective way to get your team to hate you: a ++ b
I'm super late but if you are still feeling pain in your hands/arms from coding/typing all day, try to keep your wrist at an angle below your elbows. Also try to stretch out your wrist and shoulders occasionally. Also take some time to do stretches that bring your shoulders back and traps down. (i.e. grab your hands together on your low back and pull them back). Simple but effective. These videos are so helpful and great though so thank you so much!
I also have problems with this type of pain. What I started doing is switching the mouse hand from time to time. At first it is REALLY hard to use it with the other hand (but I had no choice, was finnishing my masters and had to keep writting my dissertation and coding). But nowadays I can use both hands with the same speed. I also noticed that puting my chair higher helped. Good luck!
From where you are pointing, it could be ulnar nerve entrapment - not a doctor but I have dealt with that before. Initial cause is slouching posture for long hours that happens as you get tired. To get rid of it, plan on doing some massage and some back-strengthening exercises for quite some time. I highly recommend this book "It's Not Carpal Tunnel Syndrome! - RSI Theory and Therapy for Computer Professionals" by Suparna Damany and Jack Bellis.
finally a very in depth clarification of the differences between var, let and const! kudos for mentioning that const doesn't make object immutable, which at first is very counterintuitive. now you should do one about Object.freeze and deep-freeze 😋
I am not a doctor, but I suspect that your hand/arm pain is most probably Repetitive Strain Injury (RSI). I think that it might be helpful when you get it in, say, your right hand/arm to try to use your left hand to operate your mouse, etc. You need to be able to rest your affected limb. Thanks mpj for the vids on "becoming a better programmer" FunFunFunctions is the best I've found for a wide variety of programming topics (... and the most entertaining). Keep up the good work. I always look forward to Monday mornings at 08:00 GMT for my next "fix".
Hand pain idea... I have found the old school Microsoft Natural Keyboards to be fantastic, and I own several now. Takes some time to adjust typing style, but has helped me a lot and acts as good security as nobody else will want to use your workstation as it will ruin their typing speed.
I used to have problems with the pain and nasty sensation in my hands. I fixed that with YOGA. I discovered that everything is connected, so if you're feeling problems in your hands, you don't just need to exercise and stretch your hands but also your arms, and your neck, and your back, and your spine and your legs, and the reason for this is that everything in the body is connected so Yoga its a good remedy since it makes you stretch and excercise everything! Ive been doing Yoga for years, however not so disciplined, until i realize that it would help me with my hands problem so i had to start doing it at least three times a week and that definitely has cured me. If you're not into Yoga I'm sure you can try with Tai Chi or Kung Fu which are in the end very similar. Hope this helps others as much as it has helped me.
Man I was reading a book about es6 and it was sooooo boring I almost fell asleep without actually learning, but when I watched this, I feel like Im learning alot more in less time. Thanks man, huge help!
Kyle Simpson has written a neat explanation about how hoisting actually works (compilation vs execution) in his series of books "You Don't Know JS". Those books are an absolute must read for anyone who works in JS, even seasoned programmers can benefit from it. For the record, he has as well excellent arguments for the use of semicolons where the JS engine would put them. My argument is that ultimately semicolons communicate your intentions just like "const" do. Said that, thanks for your endless stream of video. It's really nice to see so much love for JS. I love it too :)
MPJ! My recommendation is lift weights. You don't have to lift for Strongman or join a gym, however activity will get blood-flow where needed and assist recovery in minor injuries. Stretching, swimming, moving the body in general helps. Love the video!
For pain, search on RU-vid for the video: Wrist Exercises for Tendinitis Carpal Tunnel Syndrome - Avoid RSI injury in just 2 minutes a day! Also do myofascial release using a lacrosse ball on your hands and forearms, video: Forearm Pain | Active Self Myofascial Release Icing helps a lot and taking frequent breaks. Drinking plenty of water makes a huge difference too :)
If you type a lot, consider a wrist brace (handledsstöd). My wife uses these (she's an author), and they help a lot. She prefers the type with a metal support bar, you may find those are too stiff, but braces are available without.
I switched from a mouse to a Wacom tablet and my right wrist pain stopped pretty much immediately. Took about 2 weeks to get fully comfortable with a stylus and haven't used a mouse in 10 years. I'm now using Surface Studio and Surface Pros for all development and design work.
Hi Chuck, Interesting that you swapped that way as I did exactly the opposite back in 2003 as my tablet caused pains in my wrist until I added a gel pad for support. I'm not a designer though, so I have much more keyboard use and a decent sloped/padded one works for me. Something I've recently found is my tendons tighten up which is a whole different set of pain than the pins and needles. An over-tight watch strap is something to look out for! MPJ - thanks for a very entertaining and educational style. Learning plenty from your videos even though I'm an old dog ;-)
Not sure if you already know this one but CTRL + L does "clear" for you (works in any libreadline powered shells IIRC). So node and bash are covered. For your hands, try rock climbing. You'll exercise them in new ways and toughen them up.
Thanks man, fun video! I wish I found this 6 months ago when I was banging my head against the wall on this stuff!!! Love the format and I learned a few things :).
I had some pain in my arm too. I almost couldn't use the keyboard and it hurt me for longer than 3 months. There was a video on carpal tunnel syndrome yoga, with a 1 hour session which totally recovered me form this problem. Unfortunately this particular video is not on RU-vid anymore but there are a lot of yoga sessions you can find and test.
for your arm pain -- the Microsoft comfort sculpt keyboard is awesome. best ergonomic ever, and I've tried a lot. make sure you get the sculpt comfort, there are a few sculpt models. it's the cool looking one too...
Hi, the pain you are experiencing is likely due to Carpal Tunnel Syndrome. The bones in your wrist are called carpal bones. The bones are arranged in a circle, which makes up your wrist, and this circle has a hole in the middle, which forms the tunnel. This is similar to a doughnut. The tunnel has tendons and a nerve running inside of it. When you overwork your fingers, the tendons in the tunnel become inflamed, as you mentioned. When the tendons become inflamed, they get bigger. However, the tunnel is fixed in size and cannot expand. This causes a lot of pressure to build up inside the tunnel. The nerve in the tunnel ends up getting compressed and damaged, which causes the pain in your wrist and fingers. This is called Carpal Tunnel Syndrome. The way to avoid this is to put as little strain on your fingers as possible. I am a doctor who writes a lot of code, and I had carpel tunnel syndrome in the past. I was able to fix it by buying a keyboard with keys that have a low click force. I am currently using a mechanical keyboard with Cherry MX red switches that has an actuation force of 45g. I also replaced my mouse with one that has low click force buttons. Basically, if any buttons or keys are hard to press down, get rid of it. Thank you for the great video.