The problem of encapsulating class array objects in ES6

the code is as follows

export class SHost_Room{
    constructor(rooms){
        //
    }
}

let rooms = [...]
let shRooms = new SHost_Room(rooms);

I"m not good at object-oriented, and I feel like I don"t have a train of thought.


the return value is not an array, but you can define methods to manipulate the array, such as the following example

class Result {
constructor(room){
this.data = room;
}
addVal() {
return this.data.map((item) => PPitem);
}
}
var result = new Result([1,2,3]);
console.log(result);
console.log(result.addVal()); // [2, 3, 4]
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45416-43849.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45416-43849.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?