I have been attempting to learn Javascript, and have minor experience in PHP, I was wondering how to do this code in Javascript:
[CODE]<?php
$personarr=array();
function create_person($firstname,$lastname)
{
global $personarr;
$personarr[]=array($firstname,$lastname);
}
create_person(“John”,”Doe”);
print $personarr[0];
?>
At the moment I have this:
[CODE]<html>
<head>
<script type=”text/javascript”>
var personarr=[];
function createperson(firstname,lastname)
{
personarr[]=[firstname,lastname];
}
createperson(“Djinn”,”Juice”);
document.writeln(personarr[0]);
</script>
</head>
<body>
</body>
</html>
What am I doing wrong?