Tea Party

Your task is to welcome your guests properly: Some are female and some were knighted by the queen. So greet them correctly – or this will be your last hosting.

For example:
-Jane Austen is a women, so say Hello Ms. Austen
-George Orwell is a man, so say Hello Mr. Orwell
-Isaac Newton was knighted, so say Hello Sir Newton

Good luck with your party!
Coding Kata

<html>
<body>
<script type="text/javascript">
	function welcome(lastName, isFemale, isSir){
		if (isSir)
			return "Hello Sir " + lastName + "<br />";
		else if (isFemale)
			return "Hello Ms. " + lastName + "<br />";
		else
			return "Hello Mr. " + lastName + "<br />";
	}
	
	document.write(welcome("Austen", true, false));
	document.write(welcome("Orwell", false, false));
	document.write(welcome("Newton", false, true));
</script>
</body>
</html>	

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>