Answer the question
In order to leave comments, you need to log in
How else can you create value?
I mainly program in php. Started learning javascript. Can I somehow create variables through an array? (something like this (this is in php): $a = array("gey"=>89, "dery"=> "hello")?
Ps I saw how they write document.write(a["hey"])?
( hey this is the name if that)
Answer the question
In order to leave comments, you need to log in
Associative Arrays in js since ecmascript 2015
var arr = new Map([
['key1', 'value1'],
['key2', 'value2'],
['key3', 'value3']
]);
Obviously
php .
$fruits = ["Яблоко", "Апельсин", "Слива"];
print( $fruits[0] ); // Яблоко
print( $fruits[1] ); // Апельсин
print( $fruits[2] ); // Слива
let fruits = ["Яблоко", "Апельсин", "Слива"];
alert( fruits[0] ); // Яблоко
alert( fruits[1] ); // Апельсин
alert( fruits[2] ); // Слива
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question