Skip to content

Instantly share code, notes, and snippets.

@cmoscardi
Created May 22, 2017 00:20
Show Gist options
  • Save cmoscardi/396d7254e4fee66f3e100f7f00ce0216 to your computer and use it in GitHub Desktop.
Save cmoscardi/396d7254e4fee66f3e100f7f00ce0216 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=396d7254e4fee66f3e100f7f00ce0216
<!DOCTYPE html>
<html>
<head>
<title>What Did You Click?</title>
</head>
<body>
<!-- Put your page markup here -->
<h1>Do Now</h1>
<p>You should alert the user whether or not the letter is in the word.</p>
<p>To see if a letter is in a word, you can use
</p>
<pre>
var letter = "a";
var word = ["h", "a", "t"];
// this would be true
word.includes(letter);
//so , we could do
if(word.includes(letter)){
// console.log("yes the word does include the letter");
})
</pre>
</body>
</html>
{"enabledLibraries":["jquery"],"hiddenUIComponents":["editor.css"]}
var word = ["h", "e", "l", "l", "o"];
function onKeyDown(event) {
var key = event.key;
alert("the key is " + key);
//alert("the word is " + word);
//alert("is " + key + " in " + word + " ??????");
}
$("body").keydown(onKeyDown);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment