Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

James Lemire devlemire

🎯
Focusing
  • FLBlue
  • Jacksonville FL
View GitHub Profile
View capFirstLetter.js
//make a function that takes in a string and capatalizes the first letter of every word and lowercase the rest
function capFirstLetter(str) {
str = str.toLowerCase().split(' ');
for(var i in str) {
str[i] = str[i].split('');
}
for(var j in str) {
var holder = str[j][0].charAt(0).toUpperCase();
str[j][0] = holder;
str[j] = str[j].join('');
View index.html
<!DOCTYPE html>
<head>
<title>CSS Practice</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<div id="header">
<h1>CSS Practice</h1>
View r-p-s.js
var selection = ["Rock", "Paper", "Scissors"];
var player = playerChoice();
var computer = computerChoice();
console.log(compare(player, computer));
function playerChoice() {
var choice;
do {
choice = prompt("Rock(1), Paper(2), or Scissors(3)?").toLowerCase();
View Rock-Paper-Scissors.js
var selection = ["Rock", "Paper", "Scissors"];
var player = playerChoice();
var computer = computerChoice();
console.log(compare(player, computer));
function playerChoice() {
var choice;
do {
choice = prompt("Rock(1), Paper(2), or Scissors(3)?").toLowerCase();