join function

0 Robert Summers · October 15, 2014
Hello, instructions are below the code

The code


<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" type="text/html" charset="utf-8">
<title>Robert's Website</title>
<link rel="stylesheet" type="text/css" href="main.css"/>
<script type="text/javascript">

var my_numbers = new Array(1, 5, 6, 433, 27);
document.write(my_numbers.join(" - "));

</script>
</head>

<body>

</body>

</html>


I am trying to output this, but I am stuck if someone can help, that would be awesome. Thank you.
(1) - (5) - (6) - (433) - (27)

Thank you for the help. 
Kind regards 
Robert

Post a Reply

Replies

Oldest  Newest  Rating
+1 Phillip Drake · October 20, 2014
You're welcome!
+1 Robert Summers · October 19, 2014
Thank you Philip for the help. :)
+1 Phillip Drake · October 17, 2014
Hello!  You can make the following change to get the code to look the way you are wanting:


document.write("(" + my_numbers.join(") - (") + ")");
  • 1

Javascript

107,211 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators