DEV Community 👩‍💻👨‍💻

VICTOR OMONDI
VICTOR OMONDI

Posted on

Classes In Python VS Javascript

Python:

class Person:
    def __init__(self, fname):
        self.firstname = fname


class User(Person):
    def createPost(self):
        print('Post created by', self.firstname)
Enter fullscreen mode Exit fullscreen mode

Javascript:

class Person {
    constructor(fname) {
        this.firstName = fname;
    }
}

class User extends Person {
    createPost() {
        console.log('Post created by', this.firstName);
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Top Heroku Alternatives (For Free!)

Recently Heroku shut down free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis on November 28th, 2022. So Meshv Patel put together some free alternatives in this classic DEV post.