Skip to content

Commit 0d8c7a8

Browse files
Proje dosyaları
0 parents  commit 0d8c7a8

File tree

8 files changed

+15283
-0
lines changed

8 files changed

+15283
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## JavaScript Tekrar
2+
3+
## Amaçlar
4+
5+
- JavasScipt'te öğrendiklerimizi kullanmak
6+
7+
## Giriş
8+
9+
Artık çalıştığınız iş yerinde tecrübeli bir çalışan oldunuz. Sizden yeni gelen stajyerlere destek olmanız isteniyor.
10+
Siz de çalıştığınız farklı projelerdeki bazı ufak görevlerden hazırladığınız bir projeyi, yeni stajyer arkadaşınızla beraber yaptığınızı hayal edin.
11+
12+
### Commits
13+
14+
Görevleri yaptıkça commit etmeyi unutmayınız.
15+
16+
## Talimatlar
17+
18+
### Görev 1: Proje Kurulumu
19+
20+
VSCode ve Komut Satırını Kullanma:
21+
22+
1. Bu repo'yu fork'layın
23+
2. Frok'ladığınız repo'yu bilgisayarınızda clone'layın
24+
3. LÜTFEN BRANCH OLUŞTURMAYINIZ! Bu projede main branch'ine push'layacaksın
25+
4. Repo'nuzun olduğu klasöre gidin (`cd REPO_ADI`)
26+
5. Vs code'da terminali açın ve `npm install` yazın ve çalıştırın
27+
6. Sonra `npm run test` yazın ve çalıştırın
28+
7. Projenizi tamamladıktan sonra `push` yaparak githuba aktarın
29+
30+
31+
### Görev 2: Yapılması gerekenler
32+
33+
`index.js` dosyasını bulun ve verilen görevleri tamamlayın.
34+
35+
36+
### Test Etme & Debug Yapma
37+
38+
Projenizin içinde "split terminal"i tıklayarak ikinci bir terminal ekranı açın.
39+
40+
Açılan ikinci terminalde `npm start` yazıp çalıştırın.
41+
42+
Bir terminal ekranında testleri çalıştırırken bir diğerinde ise debug yapabileceksin. Kodlarınızda güncelleme yaptıkça ilerlemeyi kontrol için `console.log`u kullanın.

babel.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
env: {
3+
test: {
4+
plugins: [
5+
'@babel/plugin-transform-runtime',
6+
],
7+
presets: [
8+
[
9+
'@babel/preset-env',
10+
{
11+
modules: 'commonjs',
12+
debug: false
13+
}
14+
]
15+
]
16+
}
17+
}
18+
};

index.js

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/* Aşağıda global olarak tanımlanmış değişkenler bulunmaktadır, bunları değiştirmeyiniz. Açıklamaları takip ederek görevleri tamamlayın. */
2+
3+
var pi = 3.14159;
4+
5+
var sayilar = [45,856,12.5,63,0.02,154,2,54,78,61.7,654,26,12.5,63,969,152,32,31,14,74,32,365.9,5.2,45,76,20,27.4,562,12.15,365.85,45.87,22,88,56.4,96.45,23,56,332,361,713,321,258.3,10,974.8,275,570,707,814,326,596,626,494,546,724.8,359,231.4,883.1,379.1,691,990,815.9,937.1,837.3,859,476,370.8,480,860,221.1,78.8,255,613,958,973.7,209,470.6,157,13,314,269.6,885,507.9,383,276,636,268.8,558.1,114.7,336,311.7,340,403.2,356.9,529.5,932.5,17,756.5,771.6,415,523.1,736,187.8,680,618.6,945,105,712,696.7,217,68,500.7,28,358.6,69,87.1,477,289,86,33,885,458,102.8,328.8,776.1,948,762,902,286,810.9,888,770,194,423,61.4,916,19,146.5,255,38.4,356,971,19,269,49.3,877.8,474,130,113.3,992,198.2,962,467.3,231,719.5,708.3,0.02,196.2,38,178.3,740,521.8,237,140,260.3,546,774.4,430,531.4,706.7,238.4,384,14,319.6,992.1,839,572,11.5,788,381,938,430,908.9,398.1,675.6,568,319.1,593,50,574,349.6,316.6,506.9,933,180,731,692,822,552,743,250.7,88.3,986,954,930.1,430.2,590.8,971.1,463.4,798,956.8,845,75,156,362,41,14.5,76,123,369.4,7.7,45,78,23,27.4,502,12.00,335.85,45.87,24,85,56.4,96.45,23,57,337.8,245,703.02,8.41,1.3,4.24,1.17,7.85,5.94,3.55,8.45,7.84,296,30.1,957.6,207,782,762,305.8,628,777,798,467.3,828,526,588,909,200.5,209,833,159.6,565,901,36,501,396.5,197.2,273,314,652,123.9,561,586,523.4,422,793.5,493.2,686,427,5.22,4.99,0.08,5.2,1.7,3.85,0.85,2.04,1.64,7.16,862,506.4,3.9,159,266,548,910.1,919,491,845,650,470.6,464.5,423.2,730.8,923,239.5,358.6,339.1,507,667.7,867.7];
6+
7+
8+
9+
/* ÖRNEK GÖREV: KareninAlani fonksiyonunu kullanarak aşağıdakileri uygulayın:
10+
1. Karenin kenar uzunluğunu fonksiyonun tek parametresi olarak alacak
11+
2. Karenin alanını hesaplayacak (💡 İPUCU: karenin alanı = karenin kenar uzunluğunun karesi)
12+
3. Hesaplanan alanı döndürecek
13+
*/
14+
15+
//Örneğin çözümü:
16+
function KareninAlani(kenaruzunlugu){
17+
return kenaruzunlugu*kenaruzunlugu;
18+
}
19+
20+
/* (Oto test yok) Yukarıdaki KareninAlani fonksiyonunu kenar uzunluğu = 10 vererek aşağıda çalıştırıp, sonucu konsolda gözlemleyin (console.log) */
21+
22+
23+
24+
/* GÖREV 1:
25+
- CemberinCevresi fonksiyonunu kullanarak aşağıdaki yönergeleri uygulayın:
26+
1. CemberinCevresi fonksiyonu parametre olarak sadece çemberin yarıçapını alacaktır.
27+
2. Global değişken olarak verilmiş pi sayısı fonksiyon içinde kullanılacak (pi sayısı fonksiyonun parametresi olarak alınmayacaktır)
28+
3. Çemberin çevresi hesaplanacaktır (💡 İPUCU: Çemberin çevresi = 2 * pi * yarıçap)
29+
4. Hesaplanan çemberin çevresi döndürülecektir.
30+
*/
31+
32+
function CemberinCevresi(/* kodlar buraya */){
33+
/* kodlar buraya */
34+
}
35+
36+
37+
/* (Oto test yok) Yukarıdaki CemberinCevresi fonksiyonunu yarıçap = 5 vererek aşağıda çalıştırıp, sonucu konsolda gözlemleyin (console.log) */
38+
39+
40+
41+
42+
/* GÖREV 2:
43+
- CemberinAlani fonksiyonunu kullanarak aşağıdaki yönergeleri uygulayın:
44+
1. Argüman olarak çemberin yarıçapını BİRİNCİ parametre olacak alacaktır.
45+
2. Global değişken olarak verilmiş pi sayısını fonksiyonun İKİNCİ parametresi olacak alacaktır.
46+
3. Çemberin alanı hesaplanacaktır (💡 İPUCU: Çemberin alanı = pi * yarıçapın karesi, yarıçapın karesini bulmak için Javascript içinde tanımlı Math kütüphanesini kullanabilirsiniz. Math.pow(yaricap,2))
47+
4. Hesaplanan çemberin alanı döndürülecektir.
48+
*/
49+
50+
function CemberinAlani(/* kodlar buraya */){
51+
/* kodlar buraya */
52+
}
53+
54+
55+
/* (Oto test yok) Yukarıdaki CemberinAlani fonksiyonunu yarıçap = 15 vererek aşağıda çalıştırıp, sonucu konsolda gözlemleyin (console.log) */
56+
57+
58+
59+
/* GÖREV 3:
60+
- Sayfanın en üstünde global değişken olarak tanımlanmış bir sayilar dizisi bulunmaktadır. Bu dizi içinde 0 ile 1000 arasında rasgele oluşturulmuş tam sayılar ve ondalıklı sayılar bulunmaktadır. Bu diziyi kullanarak aşağıdakileri uygulayın:
61+
3a. enbuyuk ve enkucuk isminde 2 adet değişken tanımlayın ve sayilar dizisindeki en küçük sayı ile en büyük sayıyı bu değişkenlere atayın. (for döngüsü kullanın)
62+
3b. `ucetambolunenler` adında bir dizi tanımlayın ve bu diziye sayilar dizisindeki 3'ün tam katı olan sayıları atayın (.forEach metodunu kullanın)
63+
3c. `ucetambolunenler` dizisindeki sayıların toplamını .reduce metoduyla bulup, sonucu `ucebolunenlerintoplami` değişkenine yazdırın (.reduce metodunu kullanın)
64+
3d. `besyuzdenkucuksayilar` adında bir dizi oluşturarak, sayilar dizisinin içindeki 500'den küçük sayıları bu diziye atayın (.filter metodunu kullanın)
65+
3e. besyuzdenkucuksayilar dizisindeki sayıları küçükten büyüğe sıralayıp `siralisayilar` adındaki bir diziye aktarın (.sort metodunu kullanın)
66+
3f. `tekraredensayilar` adında bir dizi oluşturun. sayilar dizisi içerisindeki bazı sayılar birden fazla kere yazılmış. sayilar dizisi içerisinde birden fazla kez yazılmış sayıları tespit ederek kaç kere tekrar edildiğini belirten bir string oluşturulup `tekraredensayilar` dizisine aktarılmasını istiyoruz. Örnek string: "{sayı} sayısı {kere} tekrar edilmiştir"
67+
ÖRNEK: sayilar dizisi içerisinde 45 sayısı 3 kere yazılmış. "45 sayısı 3 tekrar edilmiştir" stringini `tekraredensayilar` dizisine aktaracağız.
68+
💡 İPUCU: Tekrar edilen sayıları ve kaç kere tekrar edildiğini kaydetmek için bir nesne tanımlamalısınız, bu görevi yapabilmek için en az 2 kere döngü yazmalısınız. Birinci döngüde hangi sayının kaç kere tekrar edildiğini tespit edip, 2. döngüde stringi oluşturup verilen diziye aktarmalısınız.
69+
*/
70+
71+
72+
/* (oto test yok) sayilar dizisi içinde kaç adet sayı olduğunu konsola yazdırın */
73+
74+
75+
76+
var ucetambolunenler, enkucuk, enbuyuk, ucebolunenlerintoplami, besyuzdenkucuksayilar, siralisayilar, tekraredensayilar;
77+
78+
//3a çözümü
79+
80+
/* kodlar buraya */
81+
82+
83+
84+
// 3b çözümü:
85+
86+
/* kodlar buraya */
87+
88+
89+
90+
//3c çözümü:
91+
92+
/* kodlar buraya */
93+
94+
95+
96+
//3d çözümü
97+
98+
/* kodlar buraya */
99+
100+
101+
102+
//3e çözümü
103+
104+
/* kodlar buraya */
105+
106+
107+
//3f çözümü
108+
109+
/* kodlar buraya */
110+
111+
112+
113+
114+
115+
116+
117+
/* Bu satırın aşağısındaki kodları lütfen değiştirmeyin */
118+
function sa(){
119+
console.log('Kodlar çalışıyor');
120+
return 'as';
121+
}
122+
sa();
123+
module.exports = {
124+
sa,
125+
CemberinCevresi,
126+
CemberinAlani,
127+
ucetambolunenler,
128+
enbuyuk,
129+
enkucuk,
130+
ucebolunenlerintoplami,
131+
besyuzdenkucuksayilar,
132+
siralisayilar,
133+
tekraredensayilar
134+
}
135+

jest.config.js

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/en/configuration.html
4+
*/
5+
6+
module.exports = {
7+
// All imported modules in your tests should be mocked automatically
8+
// automock: false,
9+
10+
// Stop running tests after `n` failures
11+
// bail: 0,
12+
13+
// The directory where Jest should store its cached dependency information
14+
// cacheDirectory: "/private/var/folders/78/wsw4bc497l1b0dlb3f77xh380000gn/T/jest_dx",
15+
16+
// Automatically clear mock calls and instances between every test
17+
// clearMocks: false,
18+
19+
// Indicates whether the coverage information should be collected while executing the test
20+
// collectCoverage: false,
21+
22+
// An array of glob patterns indicating a set of files for which coverage information should be collected
23+
// collectCoverageFrom: undefined,
24+
25+
// The directory where Jest should output its coverage files
26+
// coverageDirectory: undefined,
27+
28+
// An array of regexp pattern strings used to skip coverage collection
29+
// coveragePathIgnorePatterns: [
30+
// "/node_modules/"
31+
// ],
32+
33+
// Indicates which provider should be used to instrument code for coverage
34+
coverageProvider: "v8",
35+
36+
// A list of reporter names that Jest uses when writing coverage reports
37+
// coverageReporters: [
38+
// "json",
39+
// "text",
40+
// "lcov",
41+
// "clover"
42+
// ],
43+
44+
// An object that configures minimum threshold enforcement for coverage results
45+
// coverageThreshold: undefined,
46+
47+
// A path to a custom dependency extractor
48+
// dependencyExtractor: undefined,
49+
50+
// Make calling deprecated APIs throw helpful error messages
51+
// errorOnDeprecated: false,
52+
53+
// Force coverage collection from ignored files using an array of glob patterns
54+
// forceCoverageMatch: [],
55+
56+
// A path to a module which exports an async function that is triggered once before all test suites
57+
// globalSetup: undefined,
58+
59+
// A path to a module which exports an async function that is triggered once after all test suites
60+
// globalTeardown: undefined,
61+
62+
// A set of global variables that need to be available in all test environments
63+
// globals: {},
64+
65+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66+
// maxWorkers: "50%",
67+
68+
// An array of directory names to be searched recursively up from the requiring module's location
69+
// moduleDirectories: [
70+
// "node_modules"
71+
// ],
72+
73+
// An array of file extensions your modules use
74+
// moduleFileExtensions: [
75+
// "js",
76+
// "json",
77+
// "jsx",
78+
// "ts",
79+
// "tsx",
80+
// "node"
81+
// ],
82+
83+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84+
// moduleNameMapper: {},
85+
86+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87+
// modulePathIgnorePatterns: [],
88+
89+
// Activates notifications for test results
90+
// notify: false,
91+
92+
// An enum that specifies notification mode. Requires { notify: true }
93+
// notifyMode: "failure-change",
94+
95+
// A preset that is used as a base for Jest's configuration
96+
// preset: undefined,
97+
98+
// Run tests from one or more projects
99+
// projects: undefined,
100+
101+
// Use this configuration option to add custom reporters to Jest
102+
// reporters: undefined,
103+
104+
// Automatically reset mock state between every test
105+
// resetMocks: false,
106+
107+
// Reset the module registry before running each individual test
108+
// resetModules: false,
109+
110+
// A path to a custom resolver
111+
// resolver: undefined,
112+
113+
// Automatically restore mock state between every test
114+
// restoreMocks: false,
115+
116+
// The root directory that Jest should scan for tests and modules within
117+
// rootDir: undefined,
118+
119+
// A list of paths to directories that Jest should use to search for files in
120+
// roots: [
121+
// "<rootDir>"
122+
// ],
123+
124+
// Allows you to use a custom runner instead of Jest's default test runner
125+
// runner: "jest-runner",
126+
127+
// The paths to modules that run some code to configure or set up the testing environment before each test
128+
// setupFiles: [],
129+
130+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
131+
// setupFilesAfterEnv: [],
132+
133+
// The number of seconds after which a test is considered as slow and reported as such in the results.
134+
// slowTestThreshold: 5,
135+
136+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
137+
// snapshotSerializers: [],
138+
139+
// The test environment that will be used for testing
140+
testEnvironment: "node",
141+
142+
// Options that will be passed to the testEnvironment
143+
// testEnvironmentOptions: {},
144+
145+
// Adds a location field to test results
146+
// testLocationInResults: false,
147+
148+
// The glob patterns Jest uses to detect test files
149+
// testMatch: [
150+
// "**/__tests__/**/*.[jt]s?(x)",
151+
// "**/?(*.)+(spec|test).[tj]s?(x)"
152+
// ],
153+
154+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
155+
// testPathIgnorePatterns: [
156+
// "/node_modules/"
157+
// ],
158+
159+
// The regexp pattern or array of patterns that Jest uses to detect test files
160+
// testRegex: [],
161+
162+
// This option allows the use of a custom results processor
163+
// testResultsProcessor: undefined,
164+
165+
// This option allows use of a custom test runner
166+
// testRunner: "jasmine2",
167+
168+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
169+
// testURL: "http://localhost",
170+
171+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
172+
// timers: "real",
173+
174+
// A map from regular expressions to paths to transformers
175+
// transform: undefined,
176+
177+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
178+
// transformIgnorePatterns: [
179+
// "/node_modules/",
180+
// "\\.pnp\\.[^\\/]+$"
181+
// ],
182+
183+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
184+
// unmockedModulePathPatterns: undefined,
185+
186+
// Indicates whether each individual test should be reported during the run
187+
// verbose: undefined,
188+
189+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
190+
// watchPathIgnorePatterns: [],
191+
192+
// Whether to use watchman for file crawling
193+
// watchman: true,
194+
};

0 commit comments

Comments
 (0)