Our volunteers haven't translated this article into ไทย yet. Join us and help get the job done!
You can also read the article in English (US).

Abstraction in computer programming is a way to reduce complexity and allow efficient design and implementation in complex software systems. It hides the technical complexity of systems behind simpler APIs.

Advantages of Data Abstraction

  • Helps the user to avoid writing low level code.
  • Avoids code duplication and increases reusability.
  • Can change internal implementation of class independently without affecting the user.
  • Helps to increase security of an application or program as only important details are provided to the user.


class ImplementAbstraction {
  // method to set values of internal members
  set(x, y) {
    this.a = x;
    this.b = y;

  display() {
    console.log('a = ' + this.a);
    console.log('b = ' + this.b);

const obj = new ImplementAbstraction();
obj.set(10, 20);
// a = 10
// b = 20

Learn more

General knowledge

Document Tags and Contributors

ผู้มีส่วนร่วมกับหน้านี้: Haroenv, mdnwebdocs-bot, chrisdavidmills, sunilkumarvalmiki, sideshowbarker, Jose_Fonseca, klez, Andrew_Pfeiffer, hbloomer, Jeremie, chunm
อัปเดตล่าสุดโดย: Haroenv,