WHAT IS JS OOP ONJECT ORIENTED PROGRAMMING E6 Version CODING METHODOLOGY/STYLE/PATTERN CODE MORE MODULAR AND REUSABLE ,WELL ORGANIZED EASIER TO DEBUG BEST FOR MEDIUM TO LARGE WEBISTE PROJECT CLASS 1. Properties LIKE COLOR,ENGINE,SEAT,AC ETC 2. METHOD >inside method that properties use which declare before in properties ->can create multiple method of your properties ->for called method firsty create object your class CLASS calculation propertites method let a; sum(){ c =a+b; return c;} let b; sub(){c=a-b ; return c } let c; div(){c=a/b;return c} Exmple class object step 1 class hello{ message(){ console.log("Hello My first method of class") } } setp 2 //create class object let a = new hello() //now called your method //called method step 3 a.message(); TYPES OF METHODS: CONSTRUCTOR (CALLED THIS FN SELF) CONSTRUCTOR(){console.log("Hello")} PROTOTYPE ( FOR NEED CALLING METHOD) message(){console.log("Hello)} STATIC (NO NEED OF CLASS OBJECT ) console.log("Hello") // constructor fn call auto class student{ constructor(){ console.log("constructor Function automatic called") } message(){ //this PROTOTYPE method console.log("Hello " + this .name) } } let a= new student();// self called a.name="Code By Rupesh" a.message() // take multiple variable value set(E6 using template string) call through constructor class student{ constructor(name,age){ this.studentname=name; this.studentage=age; console.log("Constructor Function auto call"); } hello(){ console.log(`Hello ${this.studentname} Your age: ${this.studentage}`) } } let a= new student("Code by Rupesh",65); //object class studnet let b=new student("Raniganj",45) // 2nd object //called method hello a.hello(); b.hello(); // static function method(no need object use class.static methodname then called) class student{ constructor(name,age){ this.studentname=name; this.studentage=age; console.log("Constructor Function auto call"); } hello(){ console.log(`Hello ${this.studentname} Your age: ${this.studentage}`) } // create static method notes don't called made by object static staticMethod(){ console.log("static method no need object for calling"); } } let a= new student("Code by Rupesh",65); // object let b=new student("Raniganj",45) //called a.hello(); b.hello(); //call static method // a.staticMethod(); // not working student.staticMethod(); // work 2.WHAT IS Inheritance CLASS A BASE CLASS Properties| METHOD |Inheritance | CLASS B DRIVED CLASS Properties METHOD use keywords extends Inheritance SYNTAX class fruits{ //properties method } class vegetables extends fruits{ //properties method } let f=new fruits() let v=new vegetables() Example: class employee{ constructor(){ console.log("constructor class :Employee") } } class manager extends employee{ } // let a =new employee() let a =new manager() // auto call emloyes becasue using inhertance output:constructor class :Employee //type:inheritance constructor to constructor method (not working so use super() for this) // The super() function is used to give access to methods and properties of a parent or sibling class. The super() function returns an object that represents the parent class. /* class employee{ constructor(name){ console.log("constructor class :Employee"+name) } } class manager extends employee{ constructor(name){ super(); console.log("Constructor :Manager"+name) } } let a =new manager("rupeshtechnologies") */ ADVANCE JS MODULES JavaScript modules are a way to organize and structure code by breaking it into smaller, reusable pieces. They help in maintaining code, avoid global namespace pollution, and manage dependencies more effectively variable- Function - FILE 1.JS _USE_ FILE 2.JS CLASS - IS CALLED MODULES & HERE IS TWO () 1.EXPORT() 2.IMPORT() In JavaScript, the export keyword is used to share code between modules The static import declaration is used to import read-only live bindings which are exported by another module. HOW TO WORK WITH MODULES file1.JS export let n="rupesh" export function hello{ } export class user{ } use in another js files file2.JS import {name} from '/file1.js' import{hello} from '/file1.js' import{user} from '/file1.js' console.log(n) hello() let a =new user() use in another html files <script type="module" scr="./file1.js"></script> Examle: //var export let message="JS E6 module message FORM LIBARAYFILS" //fun export function user(name){ console.log(`Heloo Everyone form libray ${name}`) } //class export class test{ constructor(){ console.log("this is constructor method auto call") } } // WE CAN TOGETHER EXPORT ALL' //export {message,user,test} // make Your normal fn,withod write export everytime //class /* class test{ constructor(){ console.log("this is constructor method auto call") } } */ libray2.js export default function(){ console.log("hello default fn files") } let message2="js E6 modulies default"; function user2(age){ return `${name}`; } export {message2,user2}; main.js //type 1.(single single method,fn include) import {message} from "./library.js" //console.log(message) // SHOW IN DOCUMENT document.body.innerHTML=message; import {user} from "./library.js" // single user("Rupeshtech") import {test} from "./library.js" //single call let a =new test() //type 2. WE CAN TOGETHER IMPORT ALL with comma and alize name also // import {message,user,test} from "./library.js" //all you can use alize name also // // import {message,user as us ,test} from "./library.js // type 3 (all include with *) // agr libry.js file me bahut sre fn ,method or var hai to ase import // lenghhy hota to eske lie import star* as alize name ka use krenge //adding //import *as Rupesh from ".libray.js"; //call //console.log(Rupesh.message); /* default function without name */ import {default as rupesh} from "./libray2.js" rupesh() // calling
June-06-2025 21:23:08
June-06-2025 11:35:05
June-06-2025 08:25:42
June-02-2025 21:09:41
June-02-2025 10:56:22
June-02-2025 10:27:58
June-02-2025 10:15:40
May-30-2025 19:20:40
May-30-2025 19:14:29
May-27-2025 21:52:18
May-27-2025 21:33:30
May-26-2025 17:11:41
May-26-2025 16:53:29
May-26-2025 16:50:59
May-13-2025 21:02:32
May-13-2025 17:46:23
May-12-2025 15:41:29