---
title: "Discussion on \"Object with methods implementation with and without class definition\" | Hashnode"
description: "Discussion on \"Object with methods implementation with and without class definition\". class O {\n  constructor() {\n    this.summ = 0\n  }\n  one(n) {\n    this.summ += n\n    return this\n  }\n  two(t) {\n    this.summ += t\n    return this\n  }\n  get() {\n    return this.summ\n  }\n}\n\nconst obj = {\n  summ: 0,\n  one: function (n) {\n    this.summ +..."
url: "https://hashnode.com/posts/object-with-methods-implementation-with-and-without-class-definition/6067295443f7713266913f33"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Object with methods implementation with and without class definition](https://funforfun.hashnode.dev/object-with-methods-implementation-with-and-without-class-definition?utm_source=hashnode&utm_medium=feed)

class O { constructor() { this.summ = 0 } one(n) { this.summ += n return this } two(t) { this.summ += t return this } get() { return this.summ } } const obj = { summ: 0, one: function (n) { this.summ +...

Apr 2, 2021 · 1 min read · funforfun.hashnode.dev  
Read the article

-   [#js](https://hashnode.com/tag/js)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#class](https://hashnode.com/tag/class)

## Written by

[Andrey Radkevich](https://hashnode.com/@andreyradkevich)

@andreyradkevich

  
[View profile](https://hashnode.com/@andreyradkevich)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
