Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ReservationCode {
- constructor(name, rc) {
- this.name = name;
- this.rc = rc;
- }
- getCode() {
- if (this.rc.length % 2 === 0) {// i do not assume i check
- let result='';
- for (let i = 0; i < this.rc.length; i += 2) {
- result += this.rc[i] + this.rc[i + 1] + '-'
- }
- return result.substring(result.length-1,0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement