Jump to content
Larry Ullman's Book Forums

Chapter 7 Pursue


Recommended Posts

I'm having difficulties with the first pursue activity in chapter 7. You're suppose to update today.js so neither argument can be an empty string and I'm not sure how to get started. I know how to check if a string is empty but I'm not sure how to prevent it from allowing the string to be empty. Any input would be greatly appreciated.

Link to comment
Share on other sites

Hello and welcome to the forums, Mark.

I'll start out by giving you a small hint, and if you still need a nudge, I'll give you a bigger hint.

 

For my small hint, you have to modify the following if statement so that it's even more restrictive than it is now:

 

 

   if ( (typeof elementId == 'string')
    && (typeof message == 'string') ) {

 

Does that help?

Link to comment
Share on other sites

You need to add two more conditions to the if statement. Right now, you have the following two conditions:

- typeof elementId == 'string'

- typeof message == 'string'

 

You need to use && (the AND logical operator) to add two more conditions to the if statement to further restrict the acceptable values.

That help?

Link to comment
Share on other sites

 Share

×
×
  • Create New...