Python from a JavaScript POV
In the world of computer programming, Python and JavaScript are both at the top of their class, each bringing their own unique attributes and strengths to the table. While Python is well known for being extremely user-friendly as well as easy to understand, and especially lauded by backend developers, it is quickly becoming the new industry standard for writing code in the professional world. JavaScript has long reigned in this particular kingdom of web development, able to make websites come to life with cool effects and dynamic interactivity. But I am quickly learning that these two programming languages actually share quite a bit in common!
Above all else, both Python and JavaScript focus on helping developers solve problems without getting too bogged down in technical stuff. Many other coding languages exist, but these two make great options for beginners and experts alike!
One very important thing they have in common is that they’re both really flexible with their typing. That means you don’t actually have to explicitly tell them what type of data a variable holds, because they can figure it out on their own automatically! So whether you’re storing a numeric value, a string, or even a whole list/ array of things, Python and JavaScript have got all of the important bases covered.
Now, I would like to talk about their language style. Python and JavaScript might look quite a bit different at first glance, but they actually speak pretty much the same language when it comes to writing code. They both use similar syntax with curly braces {}, semicolons ; etc in very similar ways, and they both strongly utilize the use of functions. In fact, you can do some pretty cool stuff with functions in both languages, like this for example:
#python example
def greet(name):
print("Hello, " + name + "!")
greet("Slash")//javaScript example
function greet(name) {
console.log("Hello, " + name + "!");
}
greet("Slash");Notice how both examples are able to achieve basically the same exact thing, just in a different manner.
Get nick rose’s stories in your inbox
Join Medium for free to get updates from this writer.
Python and JavaScript both come with their own unique sets of tools and helpers that make our job coding much easier. Python has its own special library filled with all sorts of helpful modules, while JavaScript has tons of cool frameworks for building websites. It’s like having a handy dandy toolbox that you can use to build all kinds of useful things!
And let’s not forget about the way they both handle objects. Both Python and JavaScript similarly are big users of object-oriented programming, which is just another way of saying they are good at organizing code into convenient little bundles called objects. Here’s a quick example in Python and JavaScript:
#python example
class Dog:
def __init__(self, name):
self.name = name
def bark(self):
print(self.name + " says woof!")
my_dog = Dog("Slash")
my_dog.bark()//javaScript example
class Dog {
constructor(name) {
this.name = name;
}
bark() {
console.log(this.name + " says woof!");
}
}
let myDog = new Dog("Slash");
myDog.bark();It seems to me almost like they’re speaking pretty much the same language!
In the end, Python and JavaScript may have different specialties, but they’re really just two sides of the same coin in my honest opinion. Whether you’re building a website, writing a game, or just tinkering with code for fun, Python and JavaScript are both there to help us out every step of the way. Im so glad to be able to give them both a try and see where this new language can take my programming skills. Despite only having been recently exposed to the world Python, only time will tell if I may just discover a whole new world of possibilities within it!




