Jump to content


Guest Dibbets

Recommended Posts

Guest Dibbets

Hi guys,


My code isnt't working. This property is supposed to return the length of the string in characters. What's wrong?


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”


<html lang=”EN” dir=”ltr” xmlns=”http://www.w3.org/1999/



<meta http-equiv="content-type" content="text/xml;

charset=utf-8" />


<script type = “text/javascript”>


//from nameLength.html

var person = prompt(“Please enter your name.”);

var length = person.length;


alert(“Hi, “ + person + “!”);

alert(“The name “ + person + “ is “ + length + “

characters long.”);






Dit is een test.




Link to comment
Share on other sites

Did you copy this from an online blog or something similar? Blogs like Wordpress change the straight double quote (") to a typographically correct slanted quote. This means you need to go through and replace any double quotes with the standard double quote from the keyboard.


Also, you can't separate your alert() into two lines, so this needs to be put on one line:


alert(“The name “ + person + “ is “ + length + “ 
characters long.”);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...