From aa61498347f0e3f1a3c3bee6b1dc587142c7293a Mon Sep 17 00:00:00 2001 From: nbal1618 <47106832+nbal1618@users.noreply.github.com> Date: Sun, 11 Aug 2019 13:14:02 +0100 Subject: [PATCH] Update helloWorld I would like some feedback because I'm new to JS. --- exercises/201-hello-world.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/exercises/201-hello-world.js b/exercises/201-hello-world.js index b84d923..dd6bd19 100644 --- a/exercises/201-hello-world.js +++ b/exercises/201-hello-world.js @@ -9,3 +9,18 @@ // Write a function "helloDefault" such that if no name is given it will return // 'Hello, world!' // Otherwise it behaves the same as the "hello" function. + +var hello = function(name) { + alert ("Hello, " + name); +} + + +var helloDefault = function(name) { + if (name != null) { + alert ("Hello, " + name); + } + else { + alert ("Hello, world!); + } +} +