Yes, you have read that, JS is one of the most powerful programming language, the first language, with a slow learning curve, that allows you to be a full stack developer.
Like you have been reading in my last post, you know JS is an interpreted language, so it makes JS run faster than other similar languages, you do not worry about speed, it's a highly advantages of using JS in your projects. I know 🤓, all that shine is not gold, but what is that?
JS has a petty strong problem with data typed, it's dynamic, so it's mean that types are assigned during execution time, it will give you a lot of problems. I'm sure you have heart talking about undefined
, but what is that?
Please, look at the following code example
let myVar;
console.log(myVar);
If you run this code you will get an undefined
response, it's mean that var has been declared but it never received any value, it's allocated in memory but empty. I'm sure, if you have coded in JS before, you know what does it mean, it give us a lot of headaches. Every time you forgot to assign any value you will get undefined and your code will never work fine. Nevertheless, how can you check that?
let myVar;
if (typeof(myVar) !=== 'undefined') console.log("Yes my var has a value")
else console.log("My var is undefined")
It's a clear example where you can see how to check if a value is undefined, don't worry 🥸 about the syntax and the meaning of each sentence, you will learn in the the following posts. Then, I mean it's a clear disadvantage of JS, but not at all. If you are a learner who is starting coding with JS such your first programming language you will love it, you won't need to think about types, however, if you have coded before you will hate it because you won't be able to avoid this errors without using typeof
.
How can I transform JS into a static typed language?
I am glad to meet you TypeScript, it's JS static typed. TS is a language that compiles into JS, it's give to JS a lot of power and extra functionalities.
I will teach you how to use all the power of TypeScript when you are a mastermind 🤨 in JS. As I said before TS solves a lot of problem and transform JS into a real high level language. Sincerely, when I used TS, I loved it, I change all my code to works with TS, giving to my applications a lot of extra functionalities but it not all, it gave to my applications a lot of extra security, due to static data typed, I could remove all typeof
checking, making my code cleaner and faster.
But please, focus on learn all about JS, it's equal to TS. With JS/TS you will be able to be a Full-Stack developer, creating real web applications that change people lifestyles. I will teach you whatever you need to create webApps 😌.
This all for today, I really want to make my blog grow, if you like this post please share with your friends. I will glad to you if you leave some comments. In the following post we will start learning JS syntax and making our first approaches to coding with JS.
Top comments (0)