" /> " /> "/>

Small library to create classes without using class syntax.

Overview

Clazz.js

Small library to create classes without using class syntax.

Compatibility

For internet explorer 11 or higher.

Example

<script src="Clazz.js"></script>
<script>
    
    let Person = Clazz({
        
        Constructor: function(first, last, age, gender, interests) {
            this.name = {
                first: first,
                last: last
            };
            this.age = age;
            this.gender = gender;
            this.interests = interests;
        },

        greeting: function() {
            console.log("Hi! I'm " + this.name.first);
        },

        farewell: function() {
            console.log(this.name.first + " has left the building. Bye for now!");
        },

        get Age(){
            return this.age
        },

        set Age(value){
            this.age = value
        },

        Static: {
            Hi: function(){
                console.log("Hello from out");
            }
        }
    });

    Person.Hi();
    // Hello from out

    let han = new Person('Han', 'Solo', 25, 'male', ['Smuggling']);
    han.greeting();
    // Hi! I'm Han

    let leia = new Person('Leia', 'Organa', 19, 'female' ['Government']);
    leia.Age = 20;
    leia.farewell();
    // Leia has left the building. Bye for now


    //-----------------------------------------------------------------------
    //Inheritance
    //-----------------------------------------------------------------------

    let Teacher = Clazz({

        Extends: Person,

        Constructor: function(first, last, age, gender, interests, subject, grade) {
            this.Super(first, last, age, gender, interests);

            // subject and grade are specific to Teacher
            this.subject = subject;
            this.grade = grade;
        },

        Static: {
            HiFive: function(){
                console.log("Hi Five!");
            }
        }
    });

    Teacher.Hi();
    // Hello from out

    Teacher.HiFive();
    // Hi Five!

    let snape = new Teacher('Severus', 'Snape', 58, 'male', ['Potions'], 'Dark arts', 5);
    snape.greeting(); 
    // Hi! I'm Severus.

    snape.farewell(); 
    // Severus has left the building. Bye for now.
    snape.Age = 60
    console.log(snape.age); // 60
    console.log(snape.subject); // Dark arts
  
</script>
You might also like...

this project is an online library application that enables users to keep track of books in their library by adding to and removing books from a list. Built with JavaScript ES6 syntax, HTML, and CSS

Awesome-Book1 The aim of this project is to restructure the Awesome books app code by using ES6 syntax and organising the workspace using modules. The

Jul 17, 2022

Unofficial Library for using Discord.JS with JSX Syntax.

@chooks22/discord.jsx WARNING! This project is in very early stage of development. And while I do have plans to finish it to completion, consider this

Nov 14, 2022

The aim of this project is to restructure the Awesome books app code by using ES6 syntax and organising the workspace using modules.

Awesome-Books-ES6 The aim of this project is to restructure the Awesome books app code by using ES6 syntax and organising the workspace using modules.

Aug 18, 2022

In this project, I built a basic website that allows users to add/remove books from a list using HTML/CSS to build the app and JavaScript to add functionalities. This project was organized using modules and ES6 syntax implemented.

Awesome books: with ES6 Description the project. Built With HTML CSS JAVASCRIPT Live Demo (if available) Live Demo Link Getting Started This is an exa

Sep 9, 2022

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

Instagram Without APIs Instagram Scraping in August 2022, no credentials required This is a Node.js library, are you looking for the same in PHP? go t

Dec 29, 2022

Dm-utils - Utility classes for ioBroker adapters to support ioBroker.dm

dm-utils Utility classes for ioBroker adapters to support ioBroker.dm. How to use In your ioBroker adapter, add a subclass of DeviceManagement and ove

Jan 2, 2022

A concise collection of classes for PHP, Python, JavaScript and Ruby to calculate great circle distance, bearing, and destination from geographic coordinates

GreatCircle A set of three functions, useful in geographical calculations of different sorts. Available for PHP, Python, Javascript and Ruby. Live dem

Sep 30, 2022

Qwerty is the first social website focused on connecting students with similar classes and gender identities

Qwerty is the first social website focused on connecting students with similar classes and gender identities

🌈 Qwerty 🌈 Qwerty is the first social website focused on connecting students with similar classes and gender identities. To get started simply input

Oct 21, 2022
Owner
Emanuel R. Vásquez
I'm ready for whatever challenges!
Emanuel R. Vásquez
🤖 Tailwind CSS assistant helps you to edit classes (includes JIT & ignores purge), toggle breakpoint classes on an element and view current breakpoint

Tailwind CSS Assistant See it in action on this example website ?? ✅ Small JavaScript package that helps you work with Tailwind CSS by... Showing you

Mark Mead 30 Dec 28, 2022
An npm package with Tailwind CSS utility classes for creating responsive grid columns without media queries using auto fit.

Grid Auto Fit for Tailwind CSS A plugin that helps you create a responsive grid layout in Tailwind CSS without using media queries. It uses the auto-f

Thirus 80 Dec 28, 2022
A refined tool for exploring open-source projects on GitHub with a file tree, rich Markdown and image previews, multi-pane multi-tab layouts and first-class support for Ink syntax highlighting.

Ink codebase browser, "Kin" ?? The Ink codebase browser is a tool to explore open-source code on GitHub, especially my side projects written in the In

Linus Lee 20 Oct 30, 2022
PublisherConnector is a class object that allows you to interact with the CHILI Publisher editorObject via postMessage without the complexity of postMessage.

PublisherConnector is a class object that allows you to interact with the CHILI Editor editorObject via postMessage without the complexity of postMessage.

CHILI publish 8 Nov 24, 2022
Start building admin tools on Slack without going into complex slack syntax and flows.

Slackmin Slackmin helps in easy integration with slack to use slash commands, interactive components, format and send messages, design and use modals.

PLG Works 49 Jan 2, 2023
Create your frontend website in multiple languages by using this class.

Javascript Langauge Selector Create your frontend website in multiple languages by using this class. Features Simple but yet powerful. Enable RTL auto

Muhammad Umer Farooq 7 Dec 14, 2022
Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

PI Calculator Web JS (Online) Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party

Max Base 6 Jul 27, 2022
✏️ A small jQuery extension to turn a static HTML table into an editable one. For quickly populating a small table with JSON data, letting the user modify it with validation, and then getting JSON data back out.

jquery-editable-table A small jQuery extension to turn an HTML table editable for fast data entry and validation Demo ?? https://jsfiddle.net/torrobin

Tor 7 Jul 31, 2022
The Easel Javascript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier.

EaselJS EaselJS is a library for building high-performance interactive 2D content in HTML5. It provides a feature-rich display list to allow you to ma

CreateJS 8k Dec 29, 2022
Personal project to a student schedule classes according his course level. Using GraphQL, Clean Code e Clean Architecture.

classes-scheduler-graphql This is a personal project for student scheduling, with classes according his course level. I intend to make just the backen

Giovanny Lucas 6 Jul 9, 2022