Skip to content

Commit bc4c417

Browse files
author
Veljko Pejović
authored
Update article.md
1 parent 47a281f commit bc4c417

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

1-js/02-first-steps/05-types/article.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
# Data types
1+
# Tipovi podataka
22

3-
A variable in JavaScript can contain any data. A variable can at one moment be a string and at another be a number:
3+
Varijabla u JavaScript-i može da sadrži bilo koje podatke. Varijabla u jednom trenutku može biti string, a u drugom broj:
44

55
```js
6-
// no error
6+
// nema greške
77
let message = "hello";
88
message = 123456;
99
```
1010

11-
Programming languages that allow such things are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them.
11+
Programski jezici koji dopuštaju takve stvari nazivaju se „dinamički kucano“, što znači da postoje tipovi podataka, ali varijable nisu vezane ni za jedan od njih.
1212

13-
There are seven basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
13+
Postoji sedam osnovnih tipova podataka u JavaScript-u. Ovde ćemo ih pokriti generalno, a u narednim ćemo poglavljima detaljno govoriti o svakom od njih.
1414

15-
## A number
15+
## Broj
1616

1717
```js
1818
let n = 123;
1919
n = 12.345;
2020
```
2121

22-
The *number* type represents both integer and floating point numbers.
22+
Tip *broj* predstavlja brojeve i brojeve sa pomičnim zarezom.
2323

24-
There are many operations for numbers, e.g. multiplication `*`, division `/`, addition `+`, subtraction `-`, and so on.
24+
Postoji mnogo operacija za brojeve, npr. množenje `*`, dijeljenje `/`, sabiranje `+`, oduzimanje `-`, itd.
2525

26-
Besides regular numbers, there are so-called "special numeric values" which also belong to this data type: `Infinity`, `-Infinity` and `NaN`.
26+
Pored regularnih brojeva, postoje i takozvane "posebne numeričke vrednosti" koje takođe pripadaju ovom tipu podataka: `Infinity`, `-Infinity` i `NaN`.
2727

28-
- `Infinity` represents the mathematical [Infinity](https://en.wikipedia.org/wiki/Infinity) ∞. It is a special value that's greater than any number.
28+
- `Infinity` predstavlja matematičku [beskonačnost](https://en.wikipedia.org/wiki/Infinity) ∞. To je posebna vrednost veća od bilo kog broja.
2929

30-
We can get it as a result of division by zero:
30+
To možemo dobiti kao rezultat podjele na nulu:
3131

3232
```js run
3333
alert( 1 / 0 ); // Infinity
3434
```
3535

36-
Or just reference it directly:
36+
Ili direktnim navođenjem:
3737

3838
```js run
3939
alert( Infinity ); // Infinity
4040
```
41-
- `NaN` represents a computational error. It is a result of an incorrect or an undefined mathematical operation, for instance:
41+
- `NaN` predstavlja grešku u računanju. Na primjer, rezultat je pogrešne ili nedefinisane matematičke operacije:
4242

4343
```js run
4444
alert( "not a number" / 2 ); // NaN, such division is erroneous
4545
```
4646

47-
`NaN` is sticky. Any further operation on `NaN` returns `NaN`:
47+
`NaN` je ljepljiv. Svako sledeća operacija na `NaN` vraća `NaN`:
4848

4949
```js run
5050
alert( "not a number" / 2 + 5 ); // NaN
5151
```
5252

53-
So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result.
53+
Dakle, ako negde u matematičkom izrazu postoji `NaN`, on se širi ka celokupnom rezultatu.
5454

55-
```smart header="Mathematical operations are safe"
56-
Doing maths is "safe" in JavaScript. We can do anything: divide by zero, treat non-numeric strings as numbers, etc.
55+
```smart header="Matematičke operacije su sigurne"
56+
Bavljenje matematikom je u JavaScriptu sigurno. Možemo učiniti bilo šta: podeliti na nulu, tretirati ne numeričke nizove kao brojeve itd.
5757
58-
The script will never stop with a fatal error ("die"). At worst, we'll get `NaN` as the result.
58+
Skripta nikada neće prestati sa fatalnom greškom ("umreti"). U najgorem slučaju dobićemo `NaN` kao rezultat.
5959
```
6060

61-
Special numeric values formally belong to the "number" type. Of course they are not numbers in the common sense of this word.
61+
Posebne numeričke vrednosti formalno pripadaju vrsti „broj“. Naravno da to nisu brojevi u zdravom smislu ove reči.
6262

63-
We'll see more about working with numbers in the chapter <info:number>.
63+
Više ćemo videti o radu sa brojevima u ovom poglavlju <info:number>.
6464

65-
## A string
65+
## String
6666

67-
A string in JavaScript must be surrounded by quotes.
67+
String u JavaScript moraju biti između znakova navodnika.
6868

6969
```js
7070
let str = "Hello";
7171
let str2 = 'Single quotes are ok too';
7272
let phrase = `can embed ${str}`;
7373
```
7474

75-
In JavaScript, there are 3 types of quotes.
75+
U JavaScript, postoje 3 vrste navodnika.
7676

77-
1. Double quotes: `"Hello"`.
78-
2. Single quotes: `'Hello'`.
79-
3. Backticks: <code>&#96;Hello&#96;</code>.
77+
1. Dupli navodnici: `"Hello"`.
78+
2. Pojedinačni navodnici: `'Hello'`.
79+
3. Zatvoreni jendostruki navodnik: <code>&#96;Hello&#96;</code>.
8080

81-
Double and single quotes are "simple" quotes. There's no difference between them in JavaScript.
81+
Dupli i pojedinačni navodnici su "jednostavni" citati. Nema razlike među njima u JavaScript-u.
8282

83-
Backticks are "extended functionality" quotes. They allow us to embed variables and expressions into a string by wrapping them in `${…}`, for example:
83+
Zatvoreni jednostruki navodnici su navodnici "proširene funkcionalnosti". Omogućuju nam da uklopimo varijable i izraze u niz omotajući ih, na primer, „$ {…}
8484

8585
```js run
8686
let name = "John";
@@ -92,19 +92,19 @@ alert( `Hello, *!*${name}*/!*!` ); // Hello, John!
9292
alert( `the result is *!*${1 + 2}*/!*` ); // the result is 3
9393
```
9494

95-
The expression inside `${…}` is evaluated and the result becomes a part of the string. We can put anything in there: a variable like `name` or an arithmetical expression like `1 + 2` or something more complex.
95+
Ekspresija unutar `$ {...}` se procjenjuje i rezultat postaje deo niza. Tamo možemo staviti bilo šta: varijablu poput „name“ ili aritmetički izraz poput „1 + 2“ ili nešto složenije.
9696

97-
Please note that this can only be done in backticks. Other quotes don't have this embedding functionality!
97+
Imajte na umu da se to može učiniti samo jednostrukom navodnicima. Ostale ponude nemaju ovu funkciju ugradnje!
9898
```js run
99-
alert( "the result is ${1 + 2}" ); // the result is ${1 + 2} (double quotes do nothing)
99+
alert( "Rezultat je ${1 + 2}" ); // Rezultat je ${1 + 2} (Dupli navodnici ne rade ništa)
100100
```
101101

102-
We'll cover strings more thoroughly in the chapter <info:string>.
102+
Detaljnije ćemo prikazati stringove u ovom poglavlju <info:string>.
103103

104-
```smart header="There is no *character* type."
105-
In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is `char`.
104+
```smart header="Nema tip *karaktera*."
105+
U nekim jezicima postoji poseban tip „karaktera“ za jedan karakter. Na primjer, na jeziku C i na Javi to je `char`.
106106
107-
In JavaScript, there is no such type. There's only one type: `string`. A string may consist of only one character or many of them.
107+
U JavaScript-u ne postoji takva vrsta. Postoji samo jedna vrsta: `string`. String se može sastojati od samo jednog znaka ili više njih.
108108
```
109109

110110
## A boolean (logical type)

0 commit comments

Comments
 (0)