Skip to main content Accessibility Feedback


Object Function Shorthand

Instead of creating a key name and then writing function () {}, you can add a named function without the function keyword.

let wizard = {

	// The old way of adding functions
	summon: function () {
		console.log('From out of thin air, watch me make a bear');

	// The ES6 shorthand way
	vanish () {
		console.log(`Now you see me, now you don't.`);


Join the Lean Web Club! Coaching. Courses. Coding resources. Get the skills, confidence, and support you need to learn front-end web development and achieve long-term success.

Find this useful? You can support my work by purchasing an annual membership.