Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update script.js #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update script.js #75

wants to merge 1 commit into from

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

@@ -23,4 +23,5 @@ const backpack = {
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