• Samantha Ming Logo Samantha Ming
  • Tidbits
  • Blog
  • Courses
  • Contact
Samantha Ming Logo
  • Home
  • Tidbits
  • Blog
  • Courses
  • Contact

  • Flexbox30
  • Newsletter
  • About
  • Invite me to speak
  • Become a sponsor

# ES6 Shorthand to Define Methods in Objects

Awesome JS tip that helps you type less! 👍

Use ES6’s concise method syntax to define methods in your objects.

const Rain = {
  // bringUmbrella: function() {}
  
  bringUmbrella() {
    return '☔️'
  }
}
Code snippet of ES6 Shorthand to Define Methods in Objects
Download HD Image
Next Tidbit
Custom CSS Selection Styling
  • Share to Twitter Twitter
  • Share to Facebook Facebook
  • Share to LinkedIn LinkedIn
  • Share to Reddit Reddit
  • Share to Hacker News Hacker News
  • Email Email

Related Tidbits

  • Pretty JSON output

  • Prevent Error with Default {} when Destructuring in JavaScript

  • JS Essentials: Falsy Values

  • 2 Ways to Merge Arrays in JavaScript

Code snippet of ES6 Shorthand to Define Methods in Objects

Top Tidbits

  • String startsWith Method

    String startsWith Method

  • Strike Through Using HTML

    Strike Through Using HTML

  • Fix Text Overlap with CSS white-space

    Fix Text Overlap with CSS white-space

  • Avoid Empty Class in Vue with Null

    Avoid Empty Class in Vue with Null

  • Centering Element With Flexbox

    Centering Element With Flexbox

  • How to Format Currency in ES6

    How to Format Currency in ES6

  • hi
  • javascript
  • html
  • css
  • vue
  • console
  • array
  • object
  • es6
  • string
  • number
  • code recipes

Courses

  • Flexbox30

    - Learn Flexbox with 30 Code Tidbits ✨

  • CodeTidbits30

    - 30 days of the best JS, CSS, HTML tidbits 🎄

  • Web Basics

    - Web Basics Explained with Tidbits 🍎

  • Pictorials

    - Step by Step Code Tutorials 👣


Top Articles

  • How to use Lodash with Vue

  • Building my New Site with VuePress

  • 3 Tips to Improve Your Programming Skills

  • Introducing the #NotFancyAppChallenge


Fresh Tidbits

  • Code snippet on HTML abbr Tag

    HTML abbr Tag

  • Code snippet on How to Pad a String with padStart and padEnd in JavaScript

    How to Pad a String with padStart and padEnd in JavaScript

  • Code snippet on Avoid Empty Class in Vue with Null

    Avoid Empty Class in Vue with Null

  • Code snippet on Fix Text Overlap with CSS white-space

    Fix Text Overlap with CSS white-space

  • Code snippet on How to Check if Object is Empty in JavaScript

    How to Check if Object is Empty in JavaScript

  • hi
  • Home
  • Tidbits
  • Blog
  • Courses
  • Newsletter
  • About
  • Contact

  • What I use
  • Flexbox30
  • Pictorials
  • Web Basics
  • Invite me to speak
  • Become a sponsor
© Copyright 2025. Samantha Ming