Skip to content

Instantly share code, notes, and snippets.

View ivankisyov's full-sized avatar
🤓
Console Logger, Level 4

Ivanman ivankisyov

🤓
Console Logger, Level 4
View GitHub Profile
@ivankisyov
ivankisyov / prototype-property-js.md
Last active December 24, 2018 11:33
Prototype Property in JS

Prototype Property in JS

When a new function is created a new property is added to it. That property is named prototype. It's an object and initially has two properties:

  • constructor: which points to the function itself;
  • __proto__
@ivankisyov
ivankisyov / what-is-dunder-proto.md
Last active November 14, 2022 07:18
What is dunder proto in JS

What is dunder proto in JS

dunder proto === __proto__

Every object in JS has this property.

It points back to the prototype object of the constructor function that created that object.

Only Object.prototype.__proto__ === null

@ivankisyov
ivankisyov / what-is-instance-in-js.md
Created December 24, 2018 11:37
What is an Instance in JS?
@ivankisyov
ivankisyov / static-methods-js.md
Created December 24, 2018 12:13
Static methods in JS "Classes"

Static methods in JS "Classes"

Methods that must be invoked on the class itself, not on its instances

class Human {
  constructor(name) {
    this.name = name;
  }
 
@ivankisyov
ivankisyov / inheritance-js.md
Last active December 24, 2018 12:27
"Inheritance" in JS

"Inheritance" in JS

class Human {
    constructor(name) {
        this.name = name
    }
   
}
@ivankisyov
ivankisyov / rest-parameters.md
Created December 25, 2018 11:57
Rest parameters

Rest parameters

function logNumbers(...args) {
  console.log(args); // type: array
}

logNumbers(1,2)
// [1, 2]
@ivankisyov
ivankisyov / classes-in-typescript.md
Last active December 25, 2018 16:04
Classes in TypeScript

Classes in TypeScript

Types of properties

  • public(the default case)
  • private
    • you can only access it from the class. Cannot set/read it from outside.
    class Human {
      private type: string = "terran";
      constructor(public name: string) {
    
@ivankisyov
ivankisyov / object-create.md
Last active December 25, 2018 17:12
Object.create

Object.create

const person = {
  name: null
}

// create new object and set its __proto__ to point to person object
const ivan = Object.create(person);
@ivankisyov
ivankisyov / object-defineProperty.md
Last active December 25, 2018 17:22
Object.defineProperty

Object.defineProperty

Todo

MDN

@ivankisyov
ivankisyov / hasownproperty.md
Last active December 25, 2018 16:44
hasOwnProperty JS

hasOwnProperty

const person = {
  name: null
}

// create new object and set its __proto__ to point to person object
const ivan = Object.create(person);