Programming & IT Tricks . Theme images by MichaelJay. Powered by Blogger.

Copyright

Facebook

Post Top Ad

Search This Blog

Post Top Ad

Responsive Ads Here

Archive

Post Top Ad

Contact


Editors Picks

Follow us

Post Top Ad

Fashion

Music

News

Sports

Food

Technology

Featured

Videos

Fashion

Technology

Fashion

Label

Translate

About

Translate

Sponsor

test

Weekly

Comments

Recent

Connect With us

Over 600,000+ Readers Get fresh content from FastBlog

About

Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Monday, February 5, 2018

Advice From A 19 Year Old Girl & Software Developer


Don’t worry, this won’t be one of the I wake up at 4AM every morning and go for a 20km run… -‘inspirational’ posts, that make people feel like they need to be some kind of super-human in order to be a good developer.
Some people might know me as ‘the girl that never does anything else but coding’ from Instagram (@theavocoder), but I’ve never really shared what I actually do on a normal day, and have done in order to become a software developer!

How I got into coding

I’m Lydia, a 19 year old girl living in Stockholm, and I am a JavaScript (React) developer! I’m very active on social media, and try to motivate more people to join the tech world by showing what my life is like in this community.
I started coding when I was 15 years old. I had a booming health & lifestyle blog on Tumblr and gained tens of thousands of followers in no-time. This is when I started creating my own responsive layouts with the regular HTML, CSS and jQuery, as I didn’t like the themes that I could buy, so I decided to just try it myself! From there on, I kept on improving my skills, gained more knowledge, and my interest in developing grew. However, I had no idea that this was already considered coding and that I could do this for a living, I simply enjoyed creating my own designs from scratch and seeing that people loved the layouts that I built and were willing to pay me for it!
I went to high school until I was 18, and absolutely hated it. I felt like I was wasting so much time on subjects that could in no way improve my future (looking at you, ancient Greek and Latin!). Nonetheless, I worked extremely hard for my diploma, worked on many personal side-projects, and have always been busy tutoring and supporting people! People have described me as the most hardworking, yet most relaxed person they’ve ever met, and I think that describes my mindset perfectly. But we’ll get back to that later!
After I finished high school, I decided to not go to university. This was a very scary step for me, as I was kind of brainwashed into thinking that that’s the only way to have a successful future: everyone around me went to the best universities! I spent so much time trying to get the best grades in high school to eventually go to a good university, did I really just waste so many years of my life for nothing? Yup, pretty much, but I don’t at all regret it! Most of the people around me didn’t understand and thought I was making a big mistake, but the small amount of people that understood and supported me really motivated me.
I’ve always been very independent: I moved to another country by myself when I was 18, travelled a lot on my own during my teens, and have always been busy doing anything to improve my future. I’ve never felt pressured into doing stuff because society wanted me to, I’ve always done my own thing. After I decided to not go to university, but give my 110% to programming instead, I went to a coding bootcamp for 3 months in Tampa Bay, Florida. I didn’t have to do this, but it definitely helped me to get some structure and be surrounded by other people who enjoyed programming as well, as I didn’t have that before. I coded intensively, was constantly out of my comfort-zone (which I love), put a lot of effort into my personal projects to improve my coding skills, and learned so many new technologies.
Guess what? Even during the 3 months, an insane amount of recruiters reached out to me asking if I could work for them. It was after I created a LinkedIn profile and could show the work I put so much effort into. As a 19-year-old girl with no work experience whatsoever, it was kind of overwhelming. I didn’t understand: did they not read my LinkedIn profile? I didn’t go to university or anything, why would so many companies want me?
Because you don’t learn how to code at school. You learn how to code by writing programs in it. Most companies don’t care if you have a nice paper saying that you studied programming at college: people care that you can show that your coding skills are good, and that you love to code.
Don’t get me wrong. If you like life at college, or simply need some more structure in your life, then it’s definitely a good decision to go there. However, don’t feel pressured. The programming community can be harsh: they hate on each other because of the language they program in, they make it seem like it’s normal to get 2 hours of sleep because you have to code all night long, and that eating junk-food and sitting all day is simply the way it is. It’s absolutely not the case.

My daily life (outside of work)

After the bootcamp ended, I flew back to Stockholm. I was extremely excited to start this new chapter in my life, and couldn’t wait to keep on growing. So what do I do nowadays on a regular day?
I wake up and try to stretch. This sounds like the typical ‘inspirational’ post I talked about earlier (they’re like everywhere in LinkedIn, it’s driving me crazy!), but it’s extremely important. You sit for hours and hours, and your body definitely suffers if you don’t take care of it. It also really wakes you up, as your heart rate increases and your brain gets more oxygen.
I try to watch online coding courses for at least 2 hours per day. I love watching online courses, because I always learn new things and get inspired by seeing the instructor writing the code with such ease. I try to give my own twist to it by working on a similar project on the side, just slightly different, so I’m not simply copying what the instructor is doing. Also, it’s perfect when you just don’t want to get out of bed and still feel like you’ve been productive ;)
I try to work on my personal projects for at least 4 hours. They make me feel super uncomfortable. I always try to use languages or techniques I’ve never used before, so I get more experience with them. And let’s be honest, it can be horrible! I’m not going to lie and say that if you work hard, you’ll get there (which you will but that’s not the point), but I also really want to emphasise on the fact that learning something new can be an emotional rollercoaster. You will feel demotivated, feel like you’ll never understand it, and really question your coding skills. If you do, congratulations! You’re a normal human being! Feeling these emotions isn’t the important part here: what you do about it is the most important part. Research it, reach out to people, write your own Stack Overflow questions (and be a hero to many people out there), and simply keep on trying until you find a solution. And if you don’t, that’s completely fine. After some time, you will probably look back at it and think “how couldn’t I get this back then?!”.
I try to read at least 2 articles. I really like seeing things from a different perspective. The articles can be about anything: how to solve a certain coding problem, why JavaScript sucks sometimes, or what the coolest new technologies are. It’s important to not get stuck in a certain mindset!
I try to solve at least 5 CodeWars Kata. CodeWars is your best friend when you just get into coding, but also when you’ve been coding for many decades! The solutions to the problems they give you are often very useful, as you will learn to improve your syntax a lot by just scrolling through the solutions that other people gave. And another big plus: when you go for your coding interview, they often give you questions that are very similar to the ones on CodeWars!
I try to not eat junk-food. Eating nutritious food keeps me very alert and, most of all, happy! I feel so much more energized and motivated when I’ve had a very healthy breakfast and lunch, which definitely improves my coding capabilities. Don’t go for fast and easy, but think long term: the better your body, the better your mind, the better your code!
Plus: you can still stretch/meditate while coding!
Did you notice something? I kept on saying “I try”. Because I’m not going to force myself to do things when I just can’t do them. I don’t want to give myself a bad feeling when I haven’t worked on my personal projects, or when I’ve eaten junk-food. Giving my 110% is my focus, but I’m human: on some days I just don’t want to code, feel tired, and just want to watch Netflix all day. And that’s completely fine! Find the right balance between relaxation and hard work. This comes back to the comments people make about me being the most hardworking yet relaxed person they’ve ever met: but it’s not easy to have this mindset!
It took me a long time to not feel bad when I hadn’t worked all day long. Especially after joining Instagram: I constantly saw posts of people coding so much that I felt like I also had to do that and simply didn’t have time to take a day off. But once I started to make relaxation an important part of my life, everything got better. I felt so much happier and I was much more motivated to work a lot.

Conclusion

By writing this article, I hope to inspire some people to also get involved in the tech world, and that it’s really not as scary as it seems. Programming isn’t only for the super intelligent super-humans like they portray in movies. Programming is for anyone who loves to create, who loves to get out of their comfort zone, and for anyone who loves to improve themselves!
To conclude, my final advice:
  • You really don’t have to go to college, as long as you can really push yourself and show your passion for coding!
  • Always give your 110% whenever you can, and show the world what you’re capable of by getting your name out there. However, always prioritize your health. Sleep is very important!
  • It is completely normal to feel uncomfortable and to think that you’re really bad at coding, don’t let this bring you down. Everyone thinks this from time to time.
  • Always remind yourself of how far you’ve come already. It’s really easy to forget how much you’ve improved, but just compare yourself now to a month ago! I can assure you it’s a lot more than you’d think.
  • Don’t let other people make you feel like the language you program in is a bad language. It’s literally not, and it’s most likely very necessary and useful!
Source :Lydia Hallie

Saturday, January 13, 2018

JavaScript — Null vs. Undefined


Learn the differences and similarities between null and undefined in JavaScript

At first glance, null and undefined may seem the same, but they are far from it. This article will explore the differences and similarities between null and undefined in JavaScript.

What is null?

There are two features of null you should understand:
  • null is an empty or non-existent value.
  • null must be assigned.
Here’s an example. We assign the value of null to a:
let a = null;
console.log(a);
// null

What is undefined?

Undefined most typically means a variable has been declared, but not defined. For example:
let b;
console.log(b);
// undefined
You can also explicitly set a variable to equal undefined:
let c = undefined;
console.log(c);
// undefined
Finally, when looking up non-existent properties in an object, you will receive undefined:
var d = {};
console.log(d.fake);
// undefined

Similarities between null and undefined

In JavaScript there are only six falsy values. Both null and undefined are two of the six falsy values. Here’s a full list:
  • false
  • 0 (zero)
  • “” (empty string)
  • null
  • undefined
  • NaN (Not A Number)
Any other value in JavaScript is considered truthy.
If you’re not familiar with truthy/falsy values in JavaScript, I recommend reading my previous article: JavaScript — Double Equals vs. Triple Equals
Also in JavaScript, there are six primitive values. Both null and undefined are primitive values. Here is a full list:
  • Boolean
  • Null
  • Undefined
  • Number
  • String
  • Symbol
All other values in JavaScript are objects (objects, functions, arrays, etc.).
Interestingly enough, when using typeof to test null, it returns object:
let a = null;
let b;
console.log(typeof a);
// object
console.log(typeof b);
// undefined
This has occurred since the beginning of JavaScript and is generally regarded as a mistake in the original JavaScript implementation.
If you’re not familiar with data types in JavaScript, I recommend reading my previous article: JavaScript Data Types Explained

null !== undefined

As you can see so far, null and undefined are different, but share some similarities. Thus, it makes sense that null does not strictly equal undefined.
null !== undefined 
But, and this may surprise you, null loosely equals undefined.
null == undefined
The explanation as to why this is true is a little complex, so bear with me. In JavaScript, a double equals tests for loose equality and preforms type coercion. This means we compare two values after converting them to a common type. Since both null and undefined are falsy values, when we compare them with loose equality, they are coerced to false prior to comparison.

Practical Differences

All of this is great, but what about a practical difference between null and undefined?
Consider the following code snippet:
let logHi = (str = 'hi') => {
  console.log(str);
}
The code above creates a function named logHi. This function requires one parameter and sets the default of that parameter to hi if it isn’t supplied. Here’s what that looks like:
logHi();
// hi
We can also supply a parameter to overwrite this default:
logHi('bye');
// bye
With default parameters, undefined will use the default while null does not.
logHi(undefined);
// hi
logHi(null);
// null
Thanks to Tim Branyen for the code inspiration.

Summary

  • null is an assigned value. It means nothing.
  • undefined typically means a variable has been declared but not defined yet.
  • null and undefined are falsy values.
  • null and undefined are both primitives. However an error shows that typeof null = object.
  • null !== undefined but null == undefined.

Wednesday, January 10, 2018

JavaScript — Shorthand Variable Assignment


A three minute introduction into shorthand variable assignment

This article will take a (very) quick look at shorthand variable assignment in JavaScript.

Assigning Variables to Other Variables

As you’re probably aware, you can assign values to variables separately, like this:
var a = 1;
var b = 1;
var c = 1;
However, if all variables are being assigned equal values, you can shorthand and assign the variables like this:
var a = b = c = 1;
The assignment operator = in JavaScript has right-to-left associativity. This means that it works from the right of the line, to the left of the line. In this example, here is the order of operation:
  • 1 — First, c is set to 1.
  • 2 — Next, b is set equal to c which is already equal to 1. Therefor, b is set to 1.
  • 3 — Finally, a is set equal to b which is already equal to 1. Therefor, a is set to 1.
As you can now see, the shorthand above results in a, b, and c all being set to 1.
However, this is not a recommended way to assign variables. That’s because in the shorthand variable assignment shown above, we actually never end up declaring variables b or c. Because of this, b and c wont be locally scoped to the current block of code. Both variables b and c will instead be globally scoped and end up polluting the global namespace.

Using Commas When Assigning Variables

Lets look at a new example. Consider the following variable declarations and assignments:
var d = 2;
var e = 3;
var f = 4;
We can shorthand this code using commas:
var d = 2, e = 3, f = 4;
As you see, we are separating each variable assignment with a comma which allows us to assign different values to each variable.
For ease of reading, most coders who prefer using the comma method will structure their variable assignments like this:
var d = 2, 
    e = 3, 
    f = 4;
Best of all, in the shorthand variable assignment shown above, we are declaring all three variables: d, e, and f. Because of this, all variables will be locally scoped and we’re able to avoid any scoping problems.

Want to Learn More Shorthands?

Check out my other articles on shorthand coding techniques in JavaScript:

Closing Notes:

Thanks for reading! If you’re ready to finally learn Web Development, check out: The Ultimate Guide to Learning Full Stack Web Development in 6 months.
If you’re working towards becoming a better JavaScript Developer, check out: Ace Your Javascript Interview — Learn Algorithms + Data Structures.

Interested for our works and services?
Get more of our update !