8 Things JavaScript does better than Python

Опубликовано: 02 Сентябрь 2021
на канале: BeGeos Dev
62
5

JavaScript and Python are 2 very beginner-friendly programming languages and they are somewhat similar. However, there are certain differences indeed. Apart from the obvious ones that Python is way better for data science, data analysis and software development, whereas JavaScript is the bible for web developers. Especially frontend developers.

Switching from Python to JavaScript there have been many things I have noticed these 2 programming languages do differently, and I don’t mean incorrectly, but ways that I like more, and others that I like less. In this video, I want to share the 8 things that I really like about JavaScript, and that I believe it does better than Python. Things that make the programming experience a bit better and sometimes even indispensable to do specific tasks.

1. Starting with Scope
This concept is very confusing the first time you hear it as a beginner in JavaScript. However, the more you code the more you realise that it is super powerful and very easy to get used to. You can declare variables, and just use them around wherever you want, just provide a scope (with brackets) and you don’t have to think about it anymore.
2. Dot Notation
Just take a second and behold the beauty and elegance that the dot notation in JavaScript has. You can chain API responses, JSON files, in the most simple and intuitive way there is. Good luck with square brackets and keyError.
3. Async
Asynchronous code is amazing and super efficient for web development, software development, performance, and much more. Dealing with the web it’s not like adding 2 numbers and data can be slow to come through, in Python you must wait for each operation to finish and yield its return values before starting the new line, or the new logic. While in JavaScript the process will be as slow as the slowest stage, not the sum of its part. Super!!
4. Easier Data Types
JavaScript doesn’t discriminate whether it’s a list, a tuple or whatever. Every, almost, iterable object is an array. And there are so many things that you could do with it, mainly build data types if you needed them. In Python, I have never used tuples, but dictionaries are essential. True they are not in JavaScript, but you have objects, and being a more versatile and flexible version of dictionaries, I’ll take them anyway.
5. Semicolon to end statement
Python has length restrictions. PEP8 suggests a line shouldn’t be longer than 79 characters. Ok, fine. However, each new line is indented in the block by 4 spaces, this means that after 2 or 3 level of indentation the number of characters become very very limited. JavaScript with its semicolons, despite being a pain in the neck sometimes, allow you to chain methods and tide up very long statements on a new line, just remember that semicolon at the end
6. Ternary Operator
Do you want a simple one-line statement to assign a value to a variable depending on whether an expression is true or false? Look no further, ternary operators in JavaScript are absolutely brilliant. They are quick, easy to understand and finally, they work.
7. It can run in the browser
The chance and ability to manipulate the DOM (Document Object Model) or the web page is essential to any full stack or frontend developer out there. JavaScript runs natively in the browser; hence it has countless methods and objects built-in that allow you to do just that. Rotate a page, change the color and so much more.
8. Switch Statement
Anytime I found myself chaining multiple if/else statements one after the other I have always wondered: “Could there be a better way?” As a matter of fact, there is, and it’s called a switch statement. Super easy, elegant, and damn fast

This was my personal chart of 8 things I believe JavaScript does better than Python. For all the web developers out there, especially if you are a beginner or you are switching languages I‘d be super-interested in what you think JavaScript does better than Python and vice versa. Let me know in the comment. Also if you liked this video please leave a like and share, I’ll see you at the next one.

BeGeos,

Social:
Twitter:   / begeosdev  
GitHub: https://github.com/BeGeos

Music:
Link: www.bensound.com

Timestamps:
00:00 Intro
00:30 Scope
1:47 Dot Notation
2:43 Async
3:49 Data Types
4:44 Semicolons
5:43 Ternary Operator
6:02 Run in the Browser
6:31 Switch Statement
7:08 Outro


На этой странице сайта вы можете посмотреть видео онлайн 8 Things JavaScript does better than Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь BeGeos Dev 02 Сентябрь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 62 раз и оно понравилось 5 зрителям. Приятного просмотра!