The Prototype design pattern creates an object that serves as a template when we need copies of it. Then, we slightly modify these copies at runtime by giving them new properties and behaviors. Unlike other design patterns, our usage of
Ruby – How to create a Class and its Object
This post shows Ruby codes that create a simple class and objects from that class. Yes, Ruby is an old and weird programming language, but people and companies are still using it. Therefore, no one programming language has a monopoly
Kotlin – create static fields and methods
This post demonstrates how to create static class members similar to that of Java. We use Kotlin 1.1 here
Working with Reference Types in JavaScript
JavaScript has both primitive and reference types. It has three primitive types: string, numeric, and boolean. Internally, these are small and fixed-sized collection of bytes that are easily and predictably manipulated at the low (primitive) levels of the JavaScript interpreter. Example of strings are ‘This is a string’ and “This is another string”. Numeric values – 1, and 3.1416. Boolean values – true or false. On the other hand, reference types are different. They include objects (including JS built-in objects), Arrays, and functions. Essentially, they can have any number of properties or elements with various types (both primitives and references), so they cannot be manipulated as easily as fixed-size primitive v
Type Checking in JavaScript
Okay, JavaScript is a loosely-typed language, which means you do not declare the data type of a variable explicitly. In a basic variable assignment expression, e.g., var i = 4;, the value that assigns to the variable determines the data type of the variable. As you assign different types of data to the same variable, its data type changes as well. Given the nature of JavaScript, finding out what data type a variable represents before using it is very important.
JavaScript Object Creation and Object Methods and Properties
[wp_ad_camp_1] If you’ve read this, it merely declares JavaScript can do OOP. It did not talked about other (more advanced) OOP stuff like access modifiers, encapsulation – behaviors and properties, and inheritance. On this article, we’ll talk more on object