Application Framework with JavaScript

Sachini Rasanga
4 min readMar 10, 2022

Overview of this blog?

This is written to get knowledge about JavaScript, version controlling, No SQL and MongodB.

JavaScript is

Text based programming language used both on the client side and server side that allows you to make web pages interactive.

JavaScript supports static methods and variables.

JavaScript Object

JavaScript variable can contain single values.

let girl= “Sachini Rasanga”

object values are written as name :value pairs (name and value separate coloms)

let person = {firstName : ”Sachini”, lastName : ”Rasanga”, age:24, eyeColor : ”black”}

JavaScript Class

Use the keyword class to create class.

class Girl {
constructor(age, height) {
this. age = age;
this. height = height;
}
}

A javaScript class is not an object.

Prototype

Prototypes are the mechanism by which JavaScript Objects. Inherit features from one another.

function Person (first, last, age, eyecolor) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eyecolor;
}

Person.prototype.name = function() {
return this.firstName + “ “ + this.lastName;
}

This in JavaScript

In JavaScript, we can use this keyword in the global and function contexts.

‘this’ in a method

const Students = {
firstName: “Sachini”,
lastName : “Rasanga”,
id : 0004,
fullName : function () {
return this.firstName + “ “ + this.lastName;
}
};

‘this’ in a Function

function myFunction() {
return this;
}

Strict Notation

It allows you to place a program or a fuction in a strict operating context. This strict context prevents certain actions from being taken and throws more exceptions. Its main purpose is to do more checking.

“use strict”;
x = 3.14;

Closure

In javaScript ,a closure is a fuction that references variables in the outer scope from its inner scope. The closure preserves the outer scope inside its inner scope.

A closure is the combination of a function bundled together(enclosed) with references to its surrounding state.

Callback and promises

A key difference between the two is when using the callback. approach we’d normally just pass a callback in to a function that would then called upon completion in order to get the result of something. In promises, however, you attach callbacks on the returned promise objects.

Version Controlling

version control also known as source control, is the practice of tracking and managing changes to software code.

Terminology

Repository: Repository is a data structure that stores metadata for a set of files or directory structure.

Trunk: Trunk refers to the unnamed branch (version)of a file tree under revision control.

Stage

Commit: A commit is an operation which sends the latest changes of the source code to the repository, making these changes part of the head revision of the repository.

Branch: The duplication of an object under version control.

Checkout: Downloading a copy of the code from the code repository.

Merge: A Fundamental operation that reconciles multiple changes made to a version-controlled collection of files.

Merge conflict: managing contributions between multiple distributed authors.

Git

o Git is most popular version control system support multiple protocol (HTTP, SSH)

o Free and open source.

GitHub

Github is a code hosting platform for version control and collaboration.

Git Commands

Git Init

Git clone

Git adds

Git stage

Git commit

Git push

MongoDB

Mongo dB is an open-source document database built on a horizontal scale-out architecture that uses a flexible schema for storing data.

mongo dB is faster than MYSQL due to its ability to handle large amount of unstructured data when it comes to speed.

mongo dB represents data as JSON documents where MYSQL represents data in tables and raw.

MongoDB Queries

Insert, Find, Update, Remove

Conclution

You can get some basic knowledge about JavaScript basics, Version controlling and Mongo DB. Mainly these essential points are discussed here.

Thank You!

--

--