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

实现 #572

Open
hello-tsai opened this issue Jun 13, 2022 · 0 comments
Open

实现 #572

hello-tsai opened this issue Jun 13, 2022 · 0 comments

Comments

@hello-tsai
Copy link

const test = {
a: 1,
b: 2,
c: 3
}

const ObjMap = (obj, fn) => {
const keys = Object.keys(obj)
for (let i =0 ; i < keys.length; i++) {
obj[keys[i]] = fn(obj[keys[i]])
}
return obj
}
console.log(ObjMap(test, item => item += 1))

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

No branches or pull requests

1 participant