Teaching Newbies since 2014

kauress

  • Home
  • Javascript ❤
    • JavaScript
    • Node.js
  • WebDev Tuts
  • screencasts
  • Resources
  • VR & AR
  • Contact
  • Github
  • Twitter
  • YouTube
  • RSS
  • C++
You are here: Home / Archives for newbie

August 26, 2020 by: Kauress

Functions as objects

In JavaScript functions are a type of object known as function object. You can work with function objects as though they were objects. Functions may be assigned to objects, passed in as arguments to other functions, returned from other functions. Additionally a function can be passed into an array. And this gets me to earlier in my articles when I’ve stated “almost everything in JavaScript

[ Read More ]

August 21, 2020 by: Kauress

Getters & Setters in JavaScript – part 2

carrying on from part 1 .. Getters in JavaScript Getters are functions that retrieve a value from static properties from an external source. You can only access properties and cannot access methods as they are functions of an object or class and are not static. There are three ways you can use getters and setters: 1. Default method syntax 2. get  keyword 3. Object.defineProperty() method

[ Read More ]

August 19, 2020 by: Kauress

Setters and Getters in JavaScript – part 1

Accessors: Getters and Setters This is part 1  of a brief introduction to getters and setters in JavaScript. Getters and Setters are ES5 features. Objects have two types of properties: Static data property Accessor property So far we have come across static data properties in the objects that we have been making. For example: let blackLivesMatter = { status: true, usecase: ‘daily’ } In this

[ Read More ]

August 18, 2020 by: Kauress

The break and continue statements in JavaScript

Break and continue statements The break statement is used to exit a loop completely once a condition has been met, or after x number of iterations. As such it is commonly used within an if conditional block. Take as an example the following code: for (let i = 0; i <= 5; i++){ console.log(i); } This will print out the value of variable i from

[ Read More ]

August 16, 2020 by: Kauress

Deep and shallow copying in JavaScript – part 2

 Copying objects with Shallow copy Now that we went over shallow and deep copies in part 1, let’s go over shallow copying in JavaScript. There are 3 ways to create shallow copies in JavaScript: Iteration using for key in an object Spread operator Object.assign() 1. Iteration using for key in an object In order to copy the items of an object into another object we

[ Read More ]

August 14, 2020 by: Kauress

Pass by reference vs Pass by Value

Pass by value Non-primitive data types are passed by reference compared to primitive data types that are passed by value. As such non-primitive data types are also called reference types. To understand why they’re called reference types, we need to briefly look at how variables are stored in memory. A fixed amount of memory is allocated to a variable after it is declared. For primitive

[ Read More ]

February 8, 2020 by: Kauress

The Learn How to Code Planner

Code Planner

ps: If you just want to download, go here: https://bit.ly/3biXP4j Learning how to code can be overwhelming! Often learners confuse a curriculum with a plan to learn coding. A curriculum is a list of topics on a particular subject for example JavaScript or python. Whereas, a planning involves the steps including the time and energy commitments to finish the curriculum. Common problematic pattern As I

[ Read More ]

January 10, 2020 by: Kauress

Enumerated types (Enum) in C++

Enum is a user defined data type in C++ whose value is equal to some user defined values. For example: Enum is useful for switch cases, when we expect a variable to have only one of the possible set of values. For example, we can change the code to:

[ Read More ]

January 9, 2020 by: Kauress

Adding/pushing data to a vector in C++

Adding data to a vector in C++ rephrased means “Push data/element into an array” in JavaScript. JavaScript uses the “push” method whereas C++ uses “push_back” In JavaScript you push an element into an array like so: The same way in C++ :

[ Read More ]

Copyright © 2021 ·Kauress