A New Life - Meditation day 1
I kept a promise to myself. I meditated today. I recently read the book “Breaking the Habit of Being Yourself” By Dr. Joe Dispenza. It is about how we can change our mind and in turn change our life. So, in the third section of this, Dr. Joe Dispenza shares mediations for 4 weeks. Each meditation needs to be done everyday for 1 week, then...
Training day 20 - Object Oriented Programming with JavaScript
Stop using var Use Const or let //Constructor function function Circle(radius) { console.log(‘this’, this); This.radius = radius; this.draw = function() { Console.log(‘draw’); } } const another = new Circle(1); //this will log the new object const second = Circle(1); //this will log the (global) window object Object.defineProprty(this, ‘defaultLocation’, { get: function() { return defaultLocation; }, set: function(value) { if(!value.x || !value.y) throw new Error(‘Invalid Location.’);...
Training day 19 - JavaScript Basic to Beginners [Functions]
Heloo people!! These are the notes of what I learned: Functions With var keyword, the scope of the variable is not limited to the code block but rather to the function it is defined in. That’s why it is better to use the let keyword Rest operator (…) is used to write down the rest of the arguments. This keyword this references the object hat...
Training day 18 - JavaScript Basic to Beginners [Arrays]
Heloo people!! These are the notes of what I learned: Objects If a function is part of an object, in object oriented programming terms - it is called a method. Factory function These factory functions produce objects. Function createCircle() { Const circle = { Radius: 1, } } numbers.shift() - add numbers to start of the array numbers.splice() - add numbers at particular position numbers.indexOf()...
Training day 17 - JavaScript Basic to Beginners
Heloo people!! In an exercise, we were asked to create objects using factorfunction and constructor function. Following is the code for it. const address = createAddress('a', 'b', 'c'); //Factory Function function createAddress(street, city, zipcode) { return{ street, city, zipcode }; } //Constructor Function let address1 = new Address('a', 'b', 'c'); function Address(street, city, zipCode) { this.street = street; this.city = city; this.zipCode = zipCode; }...