Files
hello-algo/ko/codes/javascript/modules/Vertex.js
T
Yudong Jin 2f561d3d51 feat(ko): add the Korean online edition (#2006)
* feat(ko): add the complete Korean online edition

* Use UTF-8 for Python CI output on Windows

* Remove print-book promotion from the Korean site

* fix(ko): preserve emphasis before Korean particles
2026-10-29 03:46:43 +08:00

36 lines
733 B
JavaScript

/**
* File: Vertex.js
* Created Time: 2023-02-15
* Author: Zhuo Qinyue ([email protected])
*/
/* 정점 클래스 */
class Vertex {
val;
constructor(val) {
this.val = val;
}
/* 값의 리스트 vals를 입력받아 정점 리스트 vets 반환 */
static valsToVets(vals) {
const vets = [];
for (let i = 0; i < vals.length; i++) {
vets[i] = new Vertex(vals[i]);
}
return vets;
}
/* 정점 리스트 vets를 입력받아 값의 리스트 vals 반환 */
static vetsToVals(vets) {
const vals = [];
for (const vet of vets) {
vals.push(vet.val);
}
return vals;
}
}
module.exports = {
Vertex,
};