Bassam Ismail

OpenJS Node.js Application Developer

05 September, 2022

certification jsnad

Resources

Setting up

Lab check

Knowledge Check

Node Binary

Lab check

Knowledge Check

Debugging and Diagnostics

Lab check

Knowledge Check

Key JavaScript Concepts

Lab check

function prefixer(prefix) {
	return function(message) {
		return `${prefix} ${message};
	}
}
const hi = prefixer("Hi, ");
hi("Bassam");
hi("Baheej");
const assert = require('assert');

const H = {
	hiss: () => {}
}
const P = Object.create(H, {
	prrr: {
		value: () => {}
	}
});
const M = Object.create(P, {
	meow: {
		value: () => {}
	}
});
const felix = Object.create(M);

function H() {}
H.prototype.hiss = () =>{}

function P() {
	H.call(this)
}
P.prototype.prrr = () =>{}
Object.setPrototypeOf(P.prototype, H.prototype);

function M() {
	P.call(this)
}
M.prototype.meow= () =>{}
Object.setPrototypeOf(M.prototype, P.prototype);

function H() {
	function hiss() {}
	return {hiss}
}
function P() {
	function prrr() {};
  return { ...H(), prrr}
}
function M() {
	function meow() {}
	return {...P(), meow}
}

const felix = new M();

felix.meow()
felix.prrr()
felix.hiss()

const felixProto = Object.getPrototypeOf(felix);
const felixProtoProto = Object.getPrototypeOf(felixProto);
const felixProtoProtoProto = Object.getPrototypeOf(felixProtoProto);

assert(Object.getOwnPropertyNames(felixProto).length, 1);
assert(Object.getOwnPropertyNames(felixProtoProto).length, 1);
assert(Object.getOwnPropertyNames(felixProtoProtoProto).length, 1);
assert(typeof felixProto.meow, 'function');
assert(typeof felixProtoProto.prrr, 'function');
assert(typeof felixProtoProtoProto.hiss, 'function');
console.log('All check passed');

Knowledge Check

Packages & Dependencies

Lab check

Knowledge Check

Node’s Module System

Lab check

module.exports = function (a, b) {
	return a + b;
}
const add = require('../labs-1');
console.log(add(19,23));

Knowledge Check

Asynchronous Control Flow

Lab check

opA(print)
opB(print)
opC(print)
const pa = promisify(opA);
const pb = promisify(opB);
const pc = promisify(opC);
pa().then((err, res) => {
	print(err, res);
	pb().then((err, res) => {
		print(err, res);
		pc().then((err, res) => {
			print(err, res);
		})
	})
})

Knowledge Check