Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Thanked 0 Times in 0 Posts

    I need help solving this problem. I am confused

    Write a function named sleepCheck that takes the parameter numHours
    Inside the function, write an if statement where if the number of hours of sleep is greater than or equal to 8, the computer will return "You're getting plenty of sleep! Maybe even too much!";.
    Otherwise (else) if the number of hours of sleep is less than 8, have the computer return "Get some more shut eye!";

    Then call the function with different hours of sleep

    Call the function with 10 hours of sleep, like this: sleepCheck(10);
    Call the function with 5 hours of sleep.
    Call the function with 8 hours of sleep.

  2. #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Splendora, Texas, United States of America
    Thanked 317 Times in 311 Posts
    Quote Originally Posted by bmmedia View Post
    Write a function named sleepCheck that takes the parameter numHours
    Dear confused, I have kindly made an attempt to address your issue:

    <!doctype html>
    <html lang="en">
    		<meta charset="utf-8">
    			"use strict";
    			var paragraph = document.createElement("p");
    			var homework = true;
    			var userAttempts = 0;
    			function canAssist() {
    				if (userAttempts > 1) {
    					return true;
    				else {
    					return false;
    			paragraph.textContent = "\u263a"
    			if (homework && !canAssist()) {
    				paragraph.textContent = "\u2639";
    For every complex problem, there is an answer that is clear, simple, and wrong.

    CSS Specifications


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts