Professional Documents
Culture Documents
Programavimo Pagrindai Su Javascript: Vasilij Savin VU KF Ruduo 2020
Programavimo Pagrindai Su Javascript: Vasilij Savin VU KF Ruduo 2020
Javascript
Vasilij Savin
VU KF ruduo 2020
Objektai ir masyvai
Paskaita 5.
Įvadas
Metafora:
Objektai ir masyvai yra maišeliai, kur gali būti įvairios
reikšmes ir mes galime manipuliuoti jais kaip grupę, o ne su
kiekvienu element atskirai.
Masyvai
Masyvo koncepcija
Masyvo apibrėžimas
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
Array pratimai:
https://www.w3resource.com/javascript-exercises/javascript-array-exercises.php
https://medium.com/@andrey.igorevich.borisov/10-javascript-exercises-with-arrays-c44eea1
29fba
Objektai
Objekto savybės (properties)
console.log(Math.max);
Specialūs atvejai
The two main ways to access properties in JavaScript are with a dot and with square brackets.
Both value.x and value[x] access a property on value—but not necessarily the same property.
The difference is in how x is interpreted. When using a dot, the word after the dot is the
literal name of the property. When using square brackets, the expression between the brackets
is evaluated to get the property name. Whereas value.x fetches the property of value named
“x”, value[x] tries to evaluate the expression x and uses the result, converted to a string, as
the property name.
if you want to access a property named 2 or John Doe, you must use square
brackets: value[2] or value["John Doe"].