diff --git a/13_Object_Oriented_Programming/HTML/index.html b/13_Object_Oriented_Programming/HTML/index.html index 3e1b899..4c35727 100644 --- a/13_Object_Oriented_Programming/HTML/index.html +++ b/13_Object_Oriented_Programming/HTML/index.html @@ -15,7 +15,8 @@

Javascript Object

- + + diff --git a/13_Object_Oriented_Programming/Js/51_13_9_Setter_Getter.js b/13_Object_Oriented_Programming/Js/51_13_9_Setter_Getter.js new file mode 100644 index 0000000..f5f0ba2 --- /dev/null +++ b/13_Object_Oriented_Programming/Js/51_13_9_Setter_Getter.js @@ -0,0 +1,87 @@ +//* Encapsulation + +// *Spimple Exp + +// const Person = { +// names: 'Will', +// surname: 'Mad', +// GetFullName:function(){ +// return `${this.surname} ${this.names}` +// }, +// SetFullName:function(value){ +// let post=value.split(" "); +// this.names = post[0] +// this.surname = post[1] +// } + +// } + +// console.log(Person.GetFullName()) +// Person.SetFullName("Damtion Road") +// console.log(Person.GetFullName()) + + + +//* We use + + +// const Person = { +// names: 'Will', +// surname: 'Mad', +// get FullName(){ +// return `${this.surname} ${this.names}` +// }, +// set FullName(value){ +// let post=value.split(" "); +// this.names = post[0] +// this.surname = post[1] +// } + +// } + +// console.log(Person.FullName) +// Person.FullName = 'Damtion Road' +// console.log(Person.FullName) + +// or + + +const Person ={ + names: "Bartas", + surename: "Deleveqa", +} + +Object.defineProperty(Person,"fullname",{ + get(){ + return `${this.surname} ${this.names}` + }, + set(value) { + let post=value.split(" "); + this.names = post[0] + this.surname = post[1] + } +}) + + +console.log(Person) +Person.FullName = 'Damtion Road' +console.log(Person.FullName) + + + +Object.defineProperty(Person,'age',{ + value:25 // not writable +}) + +Person.age=21 + +console.log(Person.age) + +Object.defineProperty(Person,'job',{ + value:"Damtion", // not writable + writable:true +}) + +Person.job="Teacher" + +console.log(Person.job) diff --git a/Documantation/13_Object_Oriented/documentation.md b/Documantation/13_Object_Oriented/documentation.md index 7d4091f..34f92ad 100644 --- a/Documantation/13_Object_Oriented/documentation.md +++ b/Documantation/13_Object_Oriented/documentation.md @@ -48,4 +48,11 @@ Burada bizə `Object.create()` methodu köməyimizə gəlir. ### Function that return function *** -> Bir funksiyadan return dəyər funksiya göndərə bilərik. \ No newline at end of file +> Bir funksiyadan return dəyər funksiya göndərə bilərik. + + +### Encapsulation +*** +> Obyejtləri qorumaq üçün **Encapsulation**dan istidfadə edirik. +- `set()` methodu yazmaq üçün +- `get()` methodu oxumaq üçündür. diff --git a/README.md b/README.md index cadd2cc..91b3c03 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Learning JavaScript ## My JavaScript App *** -### To Do App +## To Do App > Bu **app**-də listə itemləri əlavə edə bilirik və tək-tək və ya hamsı silə bilirik. Yazılan _data_-lar `localStorage`-ə yazılır. Yəni browser söndürülmədiyi müdətdə _data_-lar saxlanır, _reload_ edilsə belə. - [Preview](https://codepen.io/Dr-MadWill/pen/eYEoZPe) - [Code Documatation](https://github.com/DrMadWill/JavaScript#todo-list-app) @@ -9,7 +9,7 @@ - `localStorage` istifadə - _RemoveElement_-dən isfadə - _AddElement_-dən istfadə -### Slider App +## Slider App > Sadəcə _JavaScript_-dən istfadə edərək sadə _Slider_ yazmağa çalışdım.Burda _data_ olaraq göstərilən [`data`](https://github.com/DrMadWill/JavaScript/blob/main/11_Slider_App/Js/30_11_4_Slider_Duration.js#L2) obyecti _DataBases_-dən gələn məlumatları göstərir._Slider_-da default olaraq rəsimləri ardıcıl göstərir. Tələbdən aslı olarq [_random_ etmək](https://github.com/DrMadWill/JavaScript/blob/main/11_Slider_App/Js/30_11_4_Slider_Duration.js#L44) olar. _Controller_-lərin üzərinə gələn zaman [_Slider_ dayanır](https://github.com/DrMadWill/JavaScript/blob/main/11_Slider_App/Js/30_11_4_Slider_Duration.js#L53). - [Preview](https://codepen.io/Dr-MadWill/pen/QWMPErQ?editors=0010) - [Code Documatation](https://github.com/DrMadWill/JavaScript#slider-app-1) @@ -17,19 +17,19 @@ - `setInterval`-dan istfadə edilib. - `clearInterval`-dan istfadə edilib. - _radom_ xususiyyəti əlavə edib. -### Form Validation App +## Form Validation App > Validation çox zaman hazır kod blokları və ya _Packages_-dən istifadə edilir. Burada məqsəd hazır kod bloklarında istifadə etmədən öz şərtlərmizi qoyaraq bu hadisəni necə sadə yolla həyata keçrə biləcəyimizi yazmaqdır. - [Preveiw](https://codepen.io/Dr-MadWill/pen/MWEYBGg) - [Code Documatation](https://github.com/DrMadWill/JavaScript/blob/main/12_JQery/42_12_11_Form_Validation.html) - **App**-ın əsas xususiyyətləri: - _JQuery_-dən istifadə edilib. -### Back To Top App +## Back To Top App > _JQuery_ istifadə edərək sadə **Back To Top App** gəliştirməyə çalişdim. - [Preveiw](https://codepen.io/Dr-MadWill/pen/eYGmLmz) - [Code Documatation](https://github.com/DrMadWill/JavaScript/blob/main/12_JQery/41_12_11_Back_To_top.html) -### Inheritance Usage +## Inheritance Usage > `prototype`,`Object.create()` və `.call()` istifadə edərək **inheritance** ifadə etməyə çalışdım. - Preveiw - [Code Documantation](https://github.com/DrMadWill/JavaScript/blob/main/13_Object_Oriented_Programming/Js/47_13_5_InheritanceUsage.js) @@ -129,4 +129,5 @@ - [My Documantation](https://github.com/DrMadWill/JavaScript/blob/main/Documantation/13_Object_Oriented/documentation.md#immediate-function) - [Function that return function](https://github.com/DrMadWill/JavaScript/blob/main/13_Object_Oriented_Programming/Js/50_13_8_Function_return_Function.js) - [My Documantation](https://github.com/DrMadWill/JavaScript/blob/main/Documantation/13_Object_Oriented/documentation.md#function-that-return-function) - \ No newline at end of file +- [Setter Getter]() + - [My Documantation]() \ No newline at end of file