const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
toString().padStart(width) : cell.padEnd(width); }).join(''))).join
}; const proportion = (max, val) => Math.round(val * 100 / max); co
calcProportion = table => { table.sort((row1, row2) => row2[DENSITY
row1[DENSITY_COL]); const maxDensity = table[0][DENSITY_COL]; table
forEach(row => { row.push(proportion(maxDensity, row[DENSITY_COL]))
return table; }; const getDataset = file => { const lines = fs.read
FileSync(file, 'utf8').toString().split('n'); lines.shift(); lines
return lines.map(line => line.split(',')); }; const main = compose
(getDataset, calcProportion, renderTable); const fs = require('fs'
compose = (...funcs) => x => funcs.reduce((x, fn) => fn(x), x); con
DENSITY_COL = 3; const renderTable = table => { const cellWidth = [
8, 8, 18, 6]; return table.map(row => (row.map((cell, i) => { const
= cellWidth[i]; return i ? cell.toString().padStart(width) : cell.p
(width); }).join(''))).join('n'); }; const proportion = (max, val)
Прототипное
программирование
Тимур Шемсединов
github.com/HowProgrammingWorks
Chief Software Architect at Metarhia
Lecturer at Kiev Polytechnic Institute
github.com/tshemsedinov
const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
1. point.__proto__ -> pointMethods
x: Number
y: Number
__proto__
point
move(x, y)
toString()
__proto__
pointMethods
point.__proto__
toString()
valueOf()
...
Object.prototype
pointMethods.__proto__
Object.prototype.__proto__
null
const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
2. function Point(x, y) { ... }
x: Number
y: Number
__proto__
point
move(x, y)
toString()
constructor
__proto__
Point.prototype
__proto__
toString()
valueOf()
...
Object.prototype
null
__proto__ __proto__
from(obj)
prototype
__proto__
Point
constructor
prototype
apply, bind, call,
constructor
...
Function.prototype
__proto__
__proto__
const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
3. class Point { ... }
x: Number
y: Number
__proto__
point
move(x, y)
toString()
constructor
__proto__
Point.prototype
__proto__
Object.prototype
null
__proto__ __proto__
from(obj)
prototype
__proto__
Point
constructor
prototype
Function.prototype
__proto__
__proto__
Object
Function
const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
4. (#1, #2) square -> Square -> Rect
x: Number
y: Number
width: Number
height: Number
__proto__
square
move(x, y)
constructor
__proto__
Square.prototype
__proto__
Objectnull
__proto__
prototype
__proto__
Square
constructor
prototype
toString()
constructor
__proto__
Rect.prototype
prototype
__proto__
Rect
constructor
prototype
__proto__
Square.prototype
const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
4. (#3, #4, #5) square -> Square -> Rect
x: Number
y: Number
width: Number
height: Number
__proto__
square
move(x, y)
constructor
__proto__
Square.prototype
__proto__
Objectnull
__proto__
prototype
__proto__
Square
constructor
prototype
toString()
constructor
__proto__
Rect.prototype
prototype
__proto__
Rect
constructor
prototype
__proto__
const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
5. class Square extends Rect
x: Number
y: Number
width: Number
height: Number
__proto__
square
move(x, y)
constructor
__proto__
Square.prototype
__proto__
Object
__proto__
prototype
__proto__
class Square
constructor
prototype
toString()
constructor
__proto__
Rect.prototype
prototype
__proto__
class Rect
constructor
prototype
__proto__
__proto__
Function.prototype
__proto__

More Related Content

PDF
Введение в программирование (1 часть)
PDF
Базы данных в 2020
PDF
Programming Languages: comparison, history, future
PPT
Developing an ASP.NET Web Application
PPTX
Arrays in java language
PPSX
ASP.NET Web form
PDF
Bus Transit Market in Canada
PPTX
Constraint propagation
Введение в программирование (1 часть)
Базы данных в 2020
Programming Languages: comparison, history, future
Developing an ASP.NET Web Application
Arrays in java language
ASP.NET Web form
Bus Transit Market in Canada
Constraint propagation

What's hot (20)

PPTX
Introduction to ASP.NET MVC
PDF
Введение в SQL
PDF
jQuery for beginners
PDF
Es6 to es5
PDF
Node.js middleware: Never again!
PPTX
PPT
Arrays
PPT
4. Classes and Methods
PPTX
Functions & Recursion
PPSX
Java IO, Serialization
PDF
Java String
PPT
Recursion in c
PDF
Java basic concept
PDF
Building RESTful applications using Spring MVC
PPTX
Lecture 02: Preliminaries of Data structure
PPT
Strings Functions in C Programming
PPTX
Functional Programming in Swift
PPTX
datatypes and variables in c language
PPTX
How to Create an Array & types in PHP
PDF
Chapitre 3 les structures itératives.pdf
Introduction to ASP.NET MVC
Введение в SQL
jQuery for beginners
Es6 to es5
Node.js middleware: Never again!
Arrays
4. Classes and Methods
Functions & Recursion
Java IO, Serialization
Java String
Recursion in c
Java basic concept
Building RESTful applications using Spring MVC
Lecture 02: Preliminaries of Data structure
Strings Functions in C Programming
Functional Programming in Swift
datatypes and variables in c language
How to Create an Array & types in PHP
Chapitre 3 les structures itératives.pdf
Ad

Similar to Prototype programming in JavaScript (14)

PDF
Node.js in 2020 - part 2
PDF
Patterns and antipatterns
PDF
Node.js in 2020 - part 3
PDF
Новое в JavaScript: ES.Next, ECMAScript 2020, ES11, ES10, ES9, ES8, ES7, ES6,...
PDF
Node.js in 2020 - part 1
PDF
How are Race Conditions in single threaded JavaScript possible?
PDF
Asynchronous programming and mutlithreading
PDF
Race-conditions-web-locks-and-shared-memory
PDF
Node.js in 2020
PDF
JavaScript в браузере: Web API (часть 1)
PDF
Web Locks API
PDF
Private cloud without vendor lock // Serverless
PDF
Serverless Clouds (FaaS) and request context isolation in Node.js
PDF
How to keep control and safety in the clouds
Node.js in 2020 - part 2
Patterns and antipatterns
Node.js in 2020 - part 3
Новое в JavaScript: ES.Next, ECMAScript 2020, ES11, ES10, ES9, ES8, ES7, ES6,...
Node.js in 2020 - part 1
How are Race Conditions in single threaded JavaScript possible?
Asynchronous programming and mutlithreading
Race-conditions-web-locks-and-shared-memory
Node.js in 2020
JavaScript в браузере: Web API (часть 1)
Web Locks API
Private cloud without vendor lock // Serverless
Serverless Clouds (FaaS) and request context isolation in Node.js
How to keep control and safety in the clouds
Ad

More from Timur Shemsedinov (15)

PDF
How to use Chat GPT in JavaScript optimizations for Node.js
PDF
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
PDF
Multithreading in Node.js and JavaScript
PDF
Node.js threads for I/O-bound tasks
PDF
Node.js Меньше сложности, больше надежности Holy.js 2021
PDF
Rethinking low-code
PDF
Hat full of developers
PDF
FwDays 2021: Metarhia Technology Stack for Node.js
PDF
Node.js for enterprise - JS Conference
PDF
Node.js for enterprise 2021 - JavaScript Fwdays 3
PDF
Node.js in 2021
PDF
Information system structure and architecture
PDF
Почему хорошее ИТ-образование невостребовано рыночком
PDF
Node.js security
PDF
JS Fest 2019 Node.js Antipatterns
How to use Chat GPT in JavaScript optimizations for Node.js
IT Revolution in 2023-2024: AI, GPT, business transformation, future professi...
Multithreading in Node.js and JavaScript
Node.js threads for I/O-bound tasks
Node.js Меньше сложности, больше надежности Holy.js 2021
Rethinking low-code
Hat full of developers
FwDays 2021: Metarhia Technology Stack for Node.js
Node.js for enterprise - JS Conference
Node.js for enterprise 2021 - JavaScript Fwdays 3
Node.js in 2021
Information system structure and architecture
Почему хорошее ИТ-образование невостребовано рыночком
Node.js security
JS Fest 2019 Node.js Antipatterns

Recently uploaded (20)

PPTX
Introduction to Windows Operating System
PDF
E-Commerce Website Development Companyin india
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
Visual explanation of Dijkstra's Algorithm using Python
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
Microsoft Office 365 Crack Download Free
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Guide to Food Delivery App Development.pdf
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
PPTX
most interesting chapter in the world ppt
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
DNT Brochure 2025 – ISV Solutions @ D365
Introduction to Windows Operating System
E-Commerce Website Development Companyin india
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Visual explanation of Dijkstra's Algorithm using Python
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Wondershare Recoverit Full Crack New Version (Latest 2025)
Trending Python Topics for Data Visualization in 2025
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
Microsoft Office 365 Crack Download Free
How to Use SharePoint as an ISO-Compliant Document Management System
Salesforce Agentforce AI Implementation.pdf
Guide to Food Delivery App Development.pdf
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
most interesting chapter in the world ppt
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
iTop VPN Crack Latest Version Full Key 2025
DNT Brochure 2025 – ISV Solutions @ D365

Prototype programming in JavaScript

  • 1. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c toString().padStart(width) : cell.padEnd(width); }).join(''))).join }; const proportion = (max, val) => Math.round(val * 100 / max); co calcProportion = table => { table.sort((row1, row2) => row2[DENSITY row1[DENSITY_COL]); const maxDensity = table[0][DENSITY_COL]; table forEach(row => { row.push(proportion(maxDensity, row[DENSITY_COL])) return table; }; const getDataset = file => { const lines = fs.read FileSync(file, 'utf8').toString().split('n'); lines.shift(); lines return lines.map(line => line.split(',')); }; const main = compose (getDataset, calcProportion, renderTable); const fs = require('fs' compose = (...funcs) => x => funcs.reduce((x, fn) => fn(x), x); con DENSITY_COL = 3; const renderTable = table => { const cellWidth = [ 8, 8, 18, 6]; return table.map(row => (row.map((cell, i) => { const = cellWidth[i]; return i ? cell.toString().padStart(width) : cell.p (width); }).join(''))).join('n'); }; const proportion = (max, val) Прототипное программирование Тимур Шемсединов github.com/HowProgrammingWorks Chief Software Architect at Metarhia Lecturer at Kiev Polytechnic Institute github.com/tshemsedinov
  • 2. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c 1. point.__proto__ -> pointMethods x: Number y: Number __proto__ point move(x, y) toString() __proto__ pointMethods point.__proto__ toString() valueOf() ... Object.prototype pointMethods.__proto__ Object.prototype.__proto__ null
  • 3. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c 2. function Point(x, y) { ... } x: Number y: Number __proto__ point move(x, y) toString() constructor __proto__ Point.prototype __proto__ toString() valueOf() ... Object.prototype null __proto__ __proto__ from(obj) prototype __proto__ Point constructor prototype apply, bind, call, constructor ... Function.prototype __proto__ __proto__
  • 4. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c 3. class Point { ... } x: Number y: Number __proto__ point move(x, y) toString() constructor __proto__ Point.prototype __proto__ Object.prototype null __proto__ __proto__ from(obj) prototype __proto__ Point constructor prototype Function.prototype __proto__ __proto__ Object Function
  • 5. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c 4. (#1, #2) square -> Square -> Rect x: Number y: Number width: Number height: Number __proto__ square move(x, y) constructor __proto__ Square.prototype __proto__ Objectnull __proto__ prototype __proto__ Square constructor prototype toString() constructor __proto__ Rect.prototype prototype __proto__ Rect constructor prototype __proto__ Square.prototype
  • 6. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c 4. (#3, #4, #5) square -> Square -> Rect x: Number y: Number width: Number height: Number __proto__ square move(x, y) constructor __proto__ Square.prototype __proto__ Objectnull __proto__ prototype __proto__ Square constructor prototype toString() constructor __proto__ Rect.prototype prototype __proto__ Rect constructor prototype __proto__
  • 7. const fs = require('fs'); const compose = (...funcs) => x => funcs. reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma => (row.map((cell, i) => { const width = cellWidth[i]; return i ? c 5. class Square extends Rect x: Number y: Number width: Number height: Number __proto__ square move(x, y) constructor __proto__ Square.prototype __proto__ Object __proto__ prototype __proto__ class Square constructor prototype toString() constructor __proto__ Rect.prototype prototype __proto__ class Rect constructor prototype __proto__ __proto__ Function.prototype __proto__