Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mustafa Kemal Tuna lumosmind

🎯
Focusing
View GitHub Profile
View promise-example-one.js
const id = 21;
function executor (resolve, reject){
getData(id, resolve)
};
function handler(result){
console.log(result)
};
View promise-example-two.js
let id = 21;
function executor (resolve, reject){
getData(id, resolve)
};
const myPromise = new Promise(executor);
myPromise
.then((result)=>{
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){
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 callback-example.js
const id = 21;
const callback = function(data){
console.log(data)
};
getData(id, callback);
@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 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_3.js
// eski kopyalama yöntemi
// const o2 = Object.assign({}, o1);
//yeni kopyalama yöntemi
const o2 = JSON.parse(JSON.stringify(o1));
View js_oop_1_2_1.js
o2.ox.z = 333; //bu daha başlangıç :)
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