Skip to content

Conversation

utk2602
Copy link

@utk2602 utk2602 commented Jun 13, 2024

added an object in the end of the file

added an object in the end of the file
Copy link

@AvinashMarkad AvinashMarkad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Define the object with strapLength and method to set lengths
const strapSettings = {
strapLength: {
left: 0,
right: 0,
},

setStrapLengths: function(lengthLeft, lengthRight) {
    this.strapLength.left = lengthLeft;
    this.strapLength.right = lengthRight;
},

};

// Create an object and set strap lengths
const myStrap = Object.create(strapSettings);
myStrap.setStrapLengths(10, 15);

// Log the result
console.log(myStrap.strapLength.left); // Output: 10
console.log(myStrap.strapLength.right); // Output: 15

newStrapLength: function (lengthLeft, lengthRight) {
this.strapLength.left = lengthLeft;
this.strapLength.right = lengthRight;
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const myStrap = Object.create(strapSettings);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants