LoginSignup
1
0

More than 3 years have passed since last update.

JavascriptでObjectの最後のvalueを取得する方法

Last updated at Posted at 2020-08-20
const favorite = {music: "HIPHOP", food: "sushi", season: "autumn" }

最後のseasonのvalueを取得したい場合

const lastValue = Object.values(favorite)[Object.values(favorite).length - 1]; // "autumn"
1
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0