JavaScript

Showing 1 to 10 of 48 posts.

6 JavaScript Quirks that every JS developer should know!

Posted on July 4th, 2020 in JavaScript by George

Most of the developers from other languages are ofter too confident to adopt JavaScript just because they master other languages syntax. 

But what do you do when your application misbehaves and at first glance, everything looks right? Could be that you were not aware of some of the JavaScript quirks?

Without further ado, let's dive in.

Read more...

React native error "multiple commands produce.." Xcode 11

Posted on May 14th, 2020 in JavaScript, React Native by George

How to solve this issue? See the article

Read more...

How To Test React Components (hooks, Jest, Enzyme)

Posted on May 4th, 2020 in JavaScript by George

This article explains unit testing, integration testing, the end to end testing, and how to create React Component tests. 

The examples will use Jest and Enzyme for testing and the test components will be written using React hooks.

Read more...

What are JavaScript generators, function* generator?

Posted on April 27th, 2020 in JavaScript by George

Find out what a function generator looks like and what it is, with examples.

➜  jsstuff node generators.js
First Next Promise { <pending> }
{ name: 'George', age: 30, activityList: [ 'Coding', 'Running' ] }
Second Next { value: 1, done: false }
Third Next { value: '2', done: false }
Fourth Next { value: 'I am done here!', done: false }
Fifth Next { value: undefined, done: true }

 

Read more...

JavaScript Singleton (using ES6 class)

Posted on April 16th, 2020 in JavaScript by George

An example of how to implement the Singleton pattern in JavaScript using ES6 class abstraction.

Read more...

JavaScript Factory Design Pattern (using ES6 class)

Posted on April 16th, 2020 in JavaScript, NodeJS by George

A quick example of how to implement the factory pattern in Javascript using ES6 classes.

Read more...

Closures JavaScript vs Swift

Posted on January 12th, 2020 in JavaScript by George

Today I would like to bring forward comparison between closures in JavaScript to closures in Swift. 

Just to make it clear, Swift is not the same or like JavaScript. 

Swift, it is a static typed multi-paradigm, object-orientated language, JavaScript is object-orientated prototype-based language (despite the syntactic sugar added with ES6 class, constructor, etc) 

Whenever you get to use one of the main frameworks abstracted on top of each of these two programming languages you will feel the difference.

They have a very different history and different purposes (of course there are some middle grounds, as a matter of perspective).

Both languages are borrowing syntax and programing methodologies from other programming languages. And that is a good thing.

This is not the topic of this post though.

Let's get started.

 

 

Read more...

Linked list in JavaScript code example step by step

Posted on December 1st, 2019 in JavaScript by George

 

This is one way of implementing the Data Structure of type Linked List in JavaScript.

Follow the code example below and pay attention to the explicit comments.

I do focus on coding and not writing a descriptive article. I believe the best way to learn code is by reading code and writing code.

Thank you.

Read more...

smallest multiple shortest solution JavaScript

Posted on October 2nd, 2019 in JavaScript by George

function sM(v,p) {
const g=(a,b)=>b===0||a===0?a+b:g(b,a%b),l=(a,b)=>a*b/g(a,b);
let m=p?v:1,x=p?p:v,c=m;
while(m<x)c=l(c,++m);
return c;
}

// provide one or two numbers(subsequent)
sM(23);
sM(18,23);

Read more...

React mixins, Why use mixins?

Posted on January 23rd, 2019 in JavaScript by George

First of all, the reason for wich I would avoid to use mixins is that you ar are bound to use React.createClass() or create-class-module, ES6 classes are not compatibile with React mixins. 

If you are not familiar with how mixins look like, take a look at the following example:

ES5

var PureRenderMixin = require('react-addons-pure-render-mixin');

var Button = React.createClass({
  mixins: [PureRenderMixin],

  // ...

});

 

 

Read more...

Categories