-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypy.js
More file actions
56 lines (37 loc) · 1.5 KB
/
typy.js
File metadata and controls
56 lines (37 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//types.js
// Typ liczbowy (number). // Numeric type (number).
const liczba = 24;
const liczba2 = 27.54;
console.log(liczba - liczba2);
// Typ tekstowy (string). // Text (string) type.
const pierwszzeImie = "Alicja";
const zwierze = "kot";
//console.log(pierwszzeImie + " " + zwierze)
//Typ Logiczny. // Logical Type.
//const kobieta = false;
//const mezczyzna = true;
//console.log(typeof(kobieta))
// Typ null // Typ null.
const kolor = null;
console.log(kolor);
// Typ Tablica. // Type Board.
const przykladowaTablica = ["Alicja", "Tomasz", "Bartosz", 2, true];
console.log(przykladowaTablica);
// Typ obiekt. // Type of object.
const osoba = {
imie: "Tomasz",
wiek: 29,
kolorOczu: "Zielony",
plec: "mezczyzna",
};
const zmiennaLiczbowa = "55";
console.log(osoba.wiek);
//Zabawa z typami danych. //Playing with data types.
console.log(osoba.plec.length); // mieżenie długości danego typu danych. //measuring the length of a given type of data.
console.log(przykladowaTablica[1].toLocaleUpperCase()); // przekształaca nam string na duże litery. // Converts our string to uppercase..
console.log(przykladowaTablica[1].toLocaleLowerCase()); // przekształca string na małe litery. // Converts string to lowercase.
const wynikDodawania = liczba + zwierze;
console.log(wynikDodawania);
console.log(liczba2.toFixed(0)); // zaokrągla nam wartośc do określonych miejsc po przecinku. //rounds our value to the specified decimal places.
console.log(typeof String(liczba));
console.log(Number(zmiennaLiczbowa));