Last active
November 5, 2022 07:34
-
-
Save S4WA/80b804fb5972e6bc1db0fe90017d6f0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log( response( new Date().getHours() ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var time = 0; | |
setInterval(function() { | |
$('#msg').text( response(time) ); | |
console.log(time, $('#msg').text()); | |
time = time + 1; | |
if (time == 24) { | |
time = 0; | |
} | |
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function response(time) { | |
return ( time >= 0 && time < 5 ) ? 'こんばんは' : ( ( time >= 5 && time < 11 ) ? 'おはようございます' : ( time >= 11 && time < 16 ) ? 'こんにちは' : 'こんばんは' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment