* Create an object constructor function for the Backpack object type. * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
( name, volume, color, pocketNum, strapLengthL, strapLengthR, lidOpen )
| 4 | */ |
| 5 | |
| 6 | function Backpack( |
| 7 | name, |
| 8 | volume, |
| 9 | color, |
| 10 | pocketNum, |
| 11 | strapLengthL, |
| 12 | strapLengthR, |
| 13 | lidOpen |
| 14 | ) { |
| 15 | this.name = name; |
| 16 | this.volume = volume; |
| 17 | this.color = color; |
| 18 | this.pocketNum = pocketNum; |
| 19 | this.strapLength = { |
| 20 | left: strapLengthL, |
| 21 | right: strapLengthR, |
| 22 | }; |
| 23 | this.lidOpen = lidOpen; |
| 24 | this.toggleLid = function (lidStatus) { |
| 25 | this.lidOpen = lidStatus; |
| 26 | }; |
| 27 | this.newStrapLength = function (lengthLeft, lengthRight) { |
| 28 | this.strapLength.left = lengthLeft; |
| 29 | this.strapLength.right = lengthRight; |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | const everydayPack = new Backpack( |
| 34 | "Everyday Backpack", |
nothing calls this directly
no outgoing calls
no test coverage detected