-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dzień 2 #5
base: master
Are you sure you want to change the base?
Dzień 2 #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
You Don't Know JS: ES6 & Beyond | ||
Foreword | ||
yOu dOn't kNoW Js: Es6 & BeYoNd | ||
fOrEwOrD | ||
|
||
Kyle Simpson is a thorough pragmatist. | ||
kYlE SiMpSoN Is a tHoRoUgH PrAgMaTiSt. | ||
|
||
I can't think of higher praise than this. To me, these are two of the most important qualities that a software developer must have. That's right: must, not should. Kyle's keen ability to tease apart layers of the JavaScript programming language and present them in understandable and meaningful portions is second to none. | ||
[https://github.com/getify/You-Dont-Know-JS/blob/master/es6%20%26%20beyond/foreword.md] | ||
i cAn't tHiNk oF HiGhEr pRaIsE ThAn tHiS. tO Me, ThEsE ArE TwO Of tHe mOsT ImPoRtAnT QuAlItIeS ThAt a sOfTwArE DeVeLoPeR MuSt hAvE. tHaT'S RiGhT: mUsT, nOt sHoUlD. kYlE'S KeEn aBiLiTy tO TeAsE ApArT LaYeRs oF ThE JaVaScRiPt pRoGrAmMiNg lAnGuAgE AnD PrEsEnT ThEm iN UnDeRsTaNdAbLe aNd mEaNiNgFuL PoRtIoNs iS SeCoNd tO NoNe. | ||
[hTtPs://gItHuB.CoM/GeTiFy/yOu-dOnT-KnOw-jS/BlOb/mAsTeR/Es6%20%26%20BeYoNd/fOrEwOrD.Md] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
//Twój kod | ||
//Twój kod | ||
const fs = require('fs'); | ||
|
||
fs.readFile('./data/zadanie01/input.json', 'utf8', (err, data) => { | ||
if (err === null){ | ||
console.log('Poprawnie odczytano tablicę:', data); | ||
const arr = JSON.parse(data); | ||
let sum = arr.reduce(function (a, b) {return a + b;}, 0); | ||
console.log(`Suma elementów w talicy to: ` + sum); | ||
} else { | ||
console.log(`Błąd...`, err) | ||
} | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
//Twój kod | ||
//Twój kod | ||
const fs = require('fs'); | ||
|
||
fs.readdir('./data/zadanie02/', (err, files)=>{ | ||
if (err === null){ | ||
console.log('Lista plików:'); | ||
files.forEach(file => { | ||
console.log(file); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Brakuje odczytu zwartości pliku. |
||
}); | ||
} else { | ||
console.log(`Błąd...`, err) | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
//Twój kod | ||
//Twój kod | ||
const fs = require('fs'); | ||
|
||
fs.readFile('./data/zadanieDnia/test.txt', 'utf8', (err, data) => { | ||
if (err === null){ | ||
let text = data; | ||
let res = text.split('').map(function(v,i){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Najlepsze rozwiązanie. |
||
return i%2 === 0 ? v.toLowerCase():v.toUpperCase() | ||
}); | ||
console.log(res.join('')); | ||
fs.writeFile('./data/zadanieDnia/test.txt', res.join(''), err => { | ||
if (err === null){ | ||
console.log('Zapisano poprawnie!'); | ||
} else { | ||
console.log('Błąd podczas zapisu pliku!', err); | ||
} | ||
}); | ||
|
||
} else { | ||
console.log(`Błąd...`, err) | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Też może być
const
.