Currently browsing JavaScript

JavaScript Logo
Ciprian on Monday, January 15, 2018 — 409 Views

Encapsulation: Private Attribute

In JavaScript OOP there are attributes called private attributes. Knowing if an attribute is private or public, an API user can focus on [...]

JavaScript Logo
Ciprian on Monday, January 15, 2018 — 452 Views

Encapsulation: Private and Public Methods

When it comes to developing APIs, self documenting code is very important, in order to simplify users’ effort in filtering the [...]

JavaScript Logo
Ciprian on Friday, January 12, 2018 — 417 Views

Giving Object Context to Function Calls

JavaScript has a dynamic object named this. By default, this equals to the global object container, so if we have a global variable named [...]

jQuery Logo
Ciprian on Friday, January 12, 2018 — 389 Views

Self Documenting Flexible Parameters

Changing the number of JavaScript function parameters can be unproductive because of the need to update other code calling that function [...]

JavaScript Logo
Ciprian on Thursday, January 11, 2018 — 556 Views

Use ‘this’ Keyword with setTimeout()

setTimeout() is a great help to many JavaScript developers. For example, you may wish to add a delay to allow some animation to complete. [...]

JavaScript Logo
Ciprian on Thursday, January 11, 2018 — 1,311 Views

Load a JavaScript File On The Fly

Load a JavaScript file on demand and execute dependent functions. function loadFile() { // Create a script tag, set its source [...]

JavaScript Logo
Ciprian on Wednesday, January 10, 2018 — 11,573 Views

Generate HTML List From JavaScript Array

Generate an HTML list based on the contents of a JavaScript array. By modifying the makeList() function to accept parameters and target [...]

JavaScript Logo
Ciprian on Tuesday, January 9, 2018 — 488 Views

Same-Origin AJAX Request Using Vanilla JavaScript

This JavaScript function will send an AJAX request – GET or POST – with no third-party dependencies: function soQuery(soMethod, [...]

JavaScript Logo
Ciprian on Monday, January 8, 2018 — 795 Views

How to Add a CSS Stylesheet in Vanilla JavaScript

The function below will dynamically inject a CSS stylesheet in the document head using vanilla JavaScript (no dependencies): function [...]

Privacy Policy