Sign in

ES6 has object restructuring to create variables from an object’s properties.

We can create objects with {...} and properties which have key and value pair. Key has '' around it and there is : between key and value. Value can be any type.

const name = {
'firstName': 'John',
'lastName': 'Smith'

We use the . notation to get the value of properties.

let firstName = name.firstName;

Object Destructuring

We can use Javascript Object destructuring to extract values from an object property or array and assign them to a variable. The object key name is a variable that holds the value.


I have a hard time understanding and remember these Javascript Objects, Instance Methods, and Functions because I don’t use them daily. So I hope this will help you to refresh your memory.

We use objects to store multiple values as a data structure.

The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).

const numbers = [5, 6, 2, 3, 7];const max = Math.max.apply(null, numbers);console.log(max);
// expected output: 7
const min = Math.min.apply(null, numbers);console.log(min);
// expected output: 2

The bind() method creates a new function that…

I have built projects after I graduated from Flatiron school. We can build them with JS with or without React, Vue framework. I prefer to do them plain JS, so I can get a better understand of JS. This project updates CSS Variable with JS that I have learned from wesbos. Here is the initial index.html page. You can use Unsplash to add your own picture.


JavaScript Higher-Order functions allow functions that operate on other functions. These methods help to transforming, searching, and summing lists easier. These methods are are map(), filter(), reduce(), find(), forEach().

The map() method creates a new array with the results of calling a provided function on each element in this typed array.

const array = [2,3,6]
const newArray = => e + 1)
console.log(newArray) // [3,4,7]

The filter() method creates a new typed array will all elements that pass the test implemented by the provided function.

const array = [2,3,6]
const newArray = array.filter(e => e > 3)
console.log(newArray) …

Building a todos application by following these order:

1 Create the React app on the terminal. Run the command below and it will create a directory my-app

npx create-react-app app-frontend

2 Start up the React app

Change directory to app-frontend and run npm start . This will open the HTML page

cd app-frontend
npm start

This file App.jsis under the foldermy-app src . This defaults to HTML code and it is rendered on the homepage.

I graduated from Flatiron school last year. I have been prepared for my job search since then. I had a couple of HR phone interviews, technical interviews. Some companies asked you to take the assessment test prior to the phone interview. Here is an example of an online assessment test that I have recently done. This is for the Front-End Developer position that I applied for. There are 3 different questions for the test. You have 90 minutes to finish the test with the online IDE.

  1. JavaScript:

The function was provided and you need to fix the code.


Is a power of two

Given a positive integer, write a function to find if it is a power of two or not.

Naive solution

In the naive solution, we just keep dividing the number by two unless the number becomes 1 and every time we do so, we check that remainder after division is always 0. Otherwise, the number can't be a power of two.

Bitwise solution

Powers of two in binary form always have just one bit set. The only exception is with a signed integer (e.g. an 8-bit signed integer with a value of -128 looks like: 10000000)

1: 0001
2: 0010
4: 0100

Photo by Shahadat Rahman on Unsplash

I’ve been learning Data Structures and Algorithms since I graduated from Flatiron School. There are a lot of good online resources that you can use. They are online code challenges, videos, books, blogs. However, I start losing track due to overwhelming resources. I try to learn a specific topic at a time, but I forget the other language by the time I finish it. When I try to use the parallel approach I run into the problem that I can’t be able to remember all of the things that I learn. So I pick my favorites and study 1–3 of…

Euclidean Algorithm

In mathematics, the Euclidean algorithm, or Euclid’s algorithm, is an efficient method for computing the greatest common divisor (GCD) of two numbers, the largest number that divides both of them without leaving a remainder.

The Euclidean algorithm is based on the principle that the greatest common divisor of two numbers does not change if the larger number is replaced by its difference with the smaller number. For example, 21 is the GCD of 252 and 105 (as 252 = 21 × 12 and 105 = 21 × 5), and the same number 21 is also the GCD of…


In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example

5! = 5 * 4 * 3 * 2 * 1 = 120

We can use for loop:

* @param {number} number
* @return {number}
export default function factorial(number) {
let result = 1;
for (let i = 2; i <= number; i += 1) {
result *= i;
return result;

We can use recursive

* @param {number} number
* @return {number}
*/export default
function factorialRecursive(number) {…

Huy Do

Full Stack SE. I love to build beautiful web apps and learn new technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store