See the Pen Bootstrap4LayoutBoxSizingExample1 by kenan (@kenanhancer) on CodePen.
Web Technologies
Bootstrap 4 Flex Layout Example 1
See the Pen Bootstrap4_LayoutExample1 by kenan (@kenanhancer) on CodePen.
Bootstrap 4 Two Columns Form Example 1
Bootstrap 4 Example 1
JavaScript Promise and Class in ES6
JavaScript Promise in ES6
JavaScript Prototype Inheritance with IIFE in ES5
I try demonstrate inheritance with immediately invokable function expression(IIFE) and prototype in the following code.
This sample code is written in different concepts you should read the following posts as well.
The following code demonstrate classic inheritance with JavaScript.
Same code as shown in the above, but I added a new function named inherit
in global Function.prototype
so that we don't need to write same code for inheritance. It looks like Employee.inherits(Person);
or Manager.inherits(Employee);
Notice that although Employee
and Manager
functions doesn't have inherits
function, it works due to global Function.prototype.inherits
JavaScript Class, Inheritance, Override in ES6
ES6, also known as ECMAScript2015, introduced classes. Notice that classes are used in order to use inheritance.
This sample code is written in different concepts you should read the following posts as well.
Presumably this demo looks more friendly to you 🙂 actually I think so. But don't forget that no magic here still, this code is also transpiled(or compiled) to ES5 for browser compatibility.
JavaScript Prototype Inheritance with function declaration and expression in ES5
I hope that somebody who forgets this kinds of basic but very important information will find this post very useful. I have demonstrated different cases of inheritance(extension) in JavaScript so that JavaScript developers can achieve OOP.
This sample code is written in different concepts you should read the following posts as well.
I try to demonstrate inheritance with ES5 in this demo. Notice that I have used function declaration and function expression in the following code examples.
After a function is created, it looks like as following picture in the run-time.
These three pictures below show that every function created like Vehicle
has common fields. Notice that screenshots show only function fields.
Inheritance with function expression
functions like function Person()
, function Employee()
and function Manager()
don't have any parameters but we can read value of parameters from arguments
. arguments
is a built-in function parameter.
In order to pass arguments other functions I have used function apply
method.
I updated above example code as shown below. The following code demonstrate parameterised functions with function call
method.
The only difference between function call
and apply
is that call
only accepts parameters one by one but apply
accepts parameters as an array.
Person.call(this, personId, firstName, lastName, age, gender);
Person.apply(this, arguments);
Inheritance with function declaration(statement)
JavaScript Simple Http Server with Pipeline using Node.js
This demo is similar to https://kenanhancer.com/2018/01/18/javascript-pipeline-example-with-es6/
The difference between demo of previous post and this post is the object passed to the pipeline is builded by a request that client made. So that every http request will have its own middlewares pipeline.
https://gist.github.com/kenanhancer/ba63562d3171fe3fa4aa021df2663c3e