Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mustafa Kemal Tuna lumosmind

🎯
Focusing
View GitHub Profile
@lumosmind
lumosmind / js_oop_1.js
Created May 11, 2019
JS ile OOP nin 50 tonu: Object Literals
View js_oop_1.js
const o = {
x: 42,
y: 3.14,
f: function() {},
g: function() {}
};
console.log(o1); // {w: "lorem ipsum", x: 42, y: 3.14, g: ƒ, h: ƒ}
View js_oop_1.js
const o = {
x: 42,
y: 3.14,
f: function() {},
g: function() {}
};
console.log(o1); // {w: "lorem ipsum", x: 42, y: 3.14, g: ƒ, h: ƒ}
View js_oop_1_1.js
// o1 nesnesini object literal olarak tanımla
const o1 = {
w: 'lorem ipsum',
x: 42,
y: 3.14,
g: function () { },
h: function () { }
};
// o1 nesnesini kopyalayıp o2 nesnesi oluştur
View js_oop_1_2.js
// Object Literal ile nesne içinde nesne (nested objects)
const o1 = {
w: 'lorem ipsum',
x: 42,
y: 3.14,
g: function () { },
h: function () { },
// inner object
View js_oop_1_2_1.js
o2.ox.z = 333; //bu daha başlangıç :)
View js_oop_1_3.js
// eski kopyalama yöntemi
// const o2 = Object.assign({}, o1);
//yeni kopyalama yöntemi
const o2 = JSON.parse(JSON.stringify(o1));
@lumosmind
lumosmind / cloudSettings
Created Nov 21, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-11-21T09:57:13.810Z","extensionVersion":"v3.4.3"}
View callback-example.js
const id = 21;
const callback = function(data){
console.log(data)
};
getData(id, callback);
View pyramid-of-doom.js
const id = 21;
const callback = function(data1){
//1. callback fonksiyon gövdesi
console.log(data)
//asenkron kod
getData(22, function(data2){
//2. callback fonksiyon gövdesi
console.log(data,data2)
})
View pyramid-of-doom-two.js
const id = 21;
const callback = function(data1){
//1. callback fonksiyon gövdesi
console.log(data)
//asenkron kod
getData(22, function(data2){
//2. callback fonksiyon gövdesi
console.log(data,data2)
getData(23, function(data3){