I finished all the winning conditions but I broke the game when I tried to make a condition when there is a tie so I'm guessing that may be the problem. I'm not sure if this code is correct:
(xoArray[0] === 'x' || xoArray[0] === 'o')&&(xoArray[1] === 'x' || xoArray[1] === 'o')
Unfortunately I ran out of time but I'll take another look at it tomorrow and if I get it working I will make the "You win" message better.
Tuesday, April 29, 2014
Monday, April 28, 2014
Tic Tac Toe
Here are some questions I have
Could you explain the nth-child and how you applied it to tr and td?
How does this line work exactly "xoClass = (xoClass === 'x') ? 'o' : 'x';"?
I think you explained both of these to me but I still don't quite understand.
Could you explain the nth-child and how you applied it to tr and td?
How does this line work exactly "xoClass = (xoClass === 'x') ? 'o' : 'x';"?
I think you explained both of these to me but I still don't quite understand.
Friday, April 25, 2014
Wednesday, April 23, 2014
JavaScript Cash Register
Here is the code for the cash register
http://students.gctaa.net/~snicholakos/javascript/register.js
http://students.gctaa.net/~snicholakos/javascript/register.js
Tuesday, April 22, 2014
JavaScript Objects II Notes
- Constructors are actually their own type of class
- A public method can return a private variable along with other private methods
- Use "var" in a class to make the variable private and "this" to make it public
- this.age = age; (public)
var bankBalance = 7500; (private) - Inheritance is useful when 2 classes share similar properties
- "Child".prototype = new "Parent"()
- If you want a method to work with all the members of a class use "prototype"
className.prototype.newMethod = function() { statements; };- "Typeof" allows you to determine the type of a variable
- "hasOwnProperty" returns true or false whether or not an object has a certain property
- This is useful for if else statements
- "for in loops" are simplified for loops that look like this
for (var properties in nyc){ console.log(nyc[properties]); }bracket notations can be used to print the values of an object
Monday, April 21, 2014
JavaScript
I started the lesson and finished about a third of it. The review was really nice and I have my notes in a separate post just because I want it all in one post and I should be able to post that tomorrow.
Thursday, April 10, 2014
Tic Tac Toe
I fixed the positioning of the x's and o's but I still can't figure out how to prevent the x from changing to an o. I tried to put in a statement that would check but either it doesn't work or I am not putting it in the correct place.
if (!$(this).hasClass("o")) || (!$(this).hasClass("x")) {
if (!$(this).hasClass("o")) || (!$(this).hasClass("x")) {
Subscribe to:
Posts (Atom)