Skip to content

Instantly share code, notes, and snippets.

View lumosmind's full-sized avatar
🎯
Focusing

Mustafa Kemal Tuna lumosmind

🎯
Focusing
View GitHub Profile
let id = 21;
function executor (resolve, reject){
getData(id, resolve)
};
const myPromise = new Promise(executor);
myPromise
.then((result)=>{
const id = 21;
function executor (resolve, reject){
getData(id, resolve)
};
function handler(result){
console.log(result)
};
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){
@lumosmind
lumosmind / pyramid-of-doom.js
Last active November 7, 2020 17:32
pyramid of doom
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)
})
@lumosmind
lumosmind / callback-example.js
Created November 7, 2020 17:13
callback-example
const id = 21;
const callback = function(data){
console.log(data)
};
getData(id, callback);
@lumosmind
lumosmind / cloudSettings
Created November 21, 2019 09:57
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-11-21T09:57:13.810Z","extensionVersion":"v3.4.3"}
// eski kopyalama yöntemi
// const o2 = Object.assign({}, o1);
//yeni kopyalama yöntemi
const o2 = JSON.parse(JSON.stringify(o1));
o2.ox.z = 333; //bu daha başlangıç :)
// 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
// 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