Piotr Sikora - Logo - Automatyzacja procesów | AI | JavaScript | Front End | Team Leader
  • Home
  • Services
    • Process Automation
    • AI for Lawyers
    • Holded Automation
  • Blog
  • Quotes
  • Contact
PL/EN

Pure JavaScript: Private and Public Methods Guide

  • Home
  • Blog
  • Pure JavaScript: Private and Public Methods Guide
Pure JavaScript: Private and Public Methods Guide

By Piotr Sikora

  • javascript

  • 1 min read

Have you been creating your own classes in pure JavaScript?

What if you neeed a private method? How to create them?

var MyClass = (function() {
        function MyClass() {
        }

        var prvMethod = function() {
               console.log('method');
        };

        MyClass.prototype = {
            init: function() {
                console.log('init ');
                prvMethod();

            }

        };

        return MyClass;
    })();

var mc = new MyClass();
mc.init();

So finally you can access init() but cannot access prvMethod(). It has only access into MyClass() function scope.

Tags:

    #javascript

    #js

    #nodejs

    #object-oriented-programming

    #oop

    #private-method

    #public-method

Comments

Categories

after-hours(1)AI(9)ai-en(1)angular(4)automatic-tests(1)Automation(2)cryptography(1)css(8)CyberSecurity(2)Development(7)DevOps(1)events(3)javascript(11)n8n(31)ollama(1)security(2)seo(1)

Recent Posts

Prompting workshop at IdeaLab in Kielce — participants working at a laptop

AI

Effective Prompting — a Workshop for Young People at IdeaLab in Kielce

OCR in n8n for Multiple Receipts and Invoices at Once — Saving to Google Sheets

n8n

OCR in n8n for Multiple Receipts and Invoices at Once — Saving to Google Sheets

Checking Variable Values in n8n: IF vs SWITCH

n8n

Checking Variable Values in n8n: IF vs SWITCH

Automate Your Gmail with n8n — AI-Generated Reply Drafts with an LLM

n8n

Automate Your Gmail with n8n — AI-Generated Reply Drafts with an LLM

n8n: ZPE Lesson Generator — from URL to a Complete Lesson in 90 Seconds

n8n

n8n: ZPE Lesson Generator — from URL to a Complete Lesson in 90 Seconds

About Me

Piotr Sikora - Process Automation | AI | n8n | Python | JavaScript

Piotr Sikora

Process Automation Specialist

I implement automation that saves time and money, streamlines operations, and increases the predictability of results. Specializing in process automation, AI implementation, and workflow optimization using n8n, Python, and JavaScript.

n8n Workflows

n8n workflow automation templates

Explore my workflow templates on n8n. Ready-to-use automations for blog management, data collection, and AI-powered content processing.

3Workflow Templates
View Templates

• Auto-Categorize Blog Posts with AI

• Collect LinkedIn Profiles

• Export WordPress Posts for SEO

Tags

activepiecesafter-hoursahrefsaiai agentsai automationAI cost reductionai in educationai securityangularanonymizationantigravityapiAqua Securityarcade-gamesarchitectureautomationbackendbest-practicesbielik
“Never forget that only dead fish swim with the stream.”
Malcolm Muggeridge
View more quotes

Similar Articles

Discover more related content

Unleash the Power of Autoexecuted Objects in JavaScript

Unleash the Power of Autoexecuted Objects in JavaScript

Sometimes you will need to create autoexecuted object (for example in case of load/document ready events)

31 January 2014
Raspberry Pi node.js and how to start with programming GPIO

Raspberry Pi node.js and how to start with programming GPIO

Start programming Raspberry Pi GPIO with Node.js. Introduction to the PixPress project on GitHub. Hardware meets JavaScript.

Image to HTML table. Transform image to HTML table.

Image to HTML table. Transform image to HTML table.

A small Node.js script that turns any source image into a colorful HTML table, a neat trick for showing logos in emails when image loading is blocked.

Piotr Sikora | ai | n8n | javascript | python

Let's get to know each other!

Get in touch with me
Piotr Sikora | Process Automation  | AI Implementation 🤖 | Technology Consulting
Quick links
  • Home
  • Blog
  • Contact
Contact
  • piotr.sikora.ck@gmail.com
  • +48 505 684 661

© Piotr Sikora 2026 | All Rights Reserved