function markRandomTiles(that, AI, array) {
that.dataset.check = AI;
that.classList.remove("active-tile");
that.classList.add("inactive-tile");
//array.push(that);
array.push(that);
console.log("that", array.push(that));
}
else if (opponent === "AI") {
if (player_mark === "X") {
markTiles(this, "X", "O", player_mark_X, i);
let activeTiles = document.querySelectorAll(".active-tile");
alert(randomTile);
let randomTile = activeTiles[Math.floor(Math.random() * activeTiles.length)];
alert(randomTile);
markRandomTiles(randomTile, "O", player_mark_O)
// player_mark_O.push(randomTile);
// console.log(player_mark_O.push(randomTile));
player_mark = "X";
else
for that commented out? For when player_mark === "O"
?
function whatIsInAName(collection, source) {
var arr = [];
//This is my first attempt. Solves half of all the challenges but unfortunately it is not the right one. Next I will try the filter method and hopefully I will get a better understanding of it
//My thought was I would use a for loop to iterate through each object in the collection array
for (var i = 0; i < 3; i++) {
//then I used a for...in loop to go through each key in source
for (var key in source) {
//and if there was a match between a key in source and a key in any of the 3 objects of the collection array, that object would get pushed to arr. Unfortunately, if this doesn't work if source has more than one property.
//You need collection[i][key] because collection is an array with nested objects
if (source[key] === collection[i][key]){
var total = arr.push(collection[i]);
}
}
}
// Only change code above this line
return arr;
}
whatIsInAName([{ "a": 1, "b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 });
This is what I have currently. It only works when source only has one property
i
less than 3
var sourceKey = Object.keys(source);
function player_and_opponent(el, selection, container) {
return el.forEach((item) => {
item.addEventListener("click", function() {
// set global variables (yes, i know this is sketchy :\ )
window[selection] = item.value;
fadeOut(container);
//If this was the opponent being selected, make the AI play
});
});
}
gonzalezi2 sends brownie points to @jackedwardlyons :sparkles: :thumbsup: :sparkles:
:cookie: 332 | @jackedwardlyons |http://www.freecodecamp.com/jackedwardlyons
markRandomTiles(randomTile, "O", player_mark_O);
doesn't actually change the player_mark_O
array, even though you're pushing to it inside that function?
I tried logging around where you actually push inside that function
console.log(array);
array.push(that);
console.log(array);
And both logs are the same.
jackedwardlyons sends brownie points to @rationalcoding :sparkles: :thumbsup: :sparkles:
:cookie: 265 | @rationalcoding |http://www.freecodecamp.com/rationalcoding
Within that function, I tried this.
array = [];
console.log(array);
And the array doesn't change
let activeTiles = document.querySelectorAll(".active-tile"),
randomTile = activeTiles[Math.floor(Math.random() * activeTiles.length)];
let
is causing this?
let
var
seems to fix that issue.
const
either.
array = [];
console.log(array);
This will log [] now
let
made it work
array.push(index);
that
refers to the tile index in a way...
console.log(array);
array[array.length]=that;
console.log(array);
Even THIS doesn't work
console.log(array);
console.log(array.length);
This logs and array with two items, then the number 0.
var forceSet = array.slice(0);
delete array; //Doesn't work
array.push(that);
array = forceSet;
jackedwardlyons sends brownie points to @rationalcoding :sparkles: :thumbsup: :sparkles:
:cookie: 266 | @rationalcoding |http://www.freecodecamp.com/rationalcoding
[["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]
to [{ 'PENNY': 1.01},
{'NICKEL': 2.05},
{'DIME': 3.1},
{'QUARTER': 4.25},
{'ONE': 90},
{'FIVE': 55},
{'TEN': 20},
{'TWENTY': 60},
{'ONE HUNDRED': 100 }]
["a", "b"]
into a key-value pair like {"a":"b"}
like this:function arrayToObject(arrayPair){
var newObject = {}; //Make a new object. ie ["a", "b"]
newObject[arrayPair[0]] = arrayPair[1]; //Make a key-value pair. ie newObject["a"] = "b";
return newObject; //Return the object. ie {"a":"b"}
}
c0d0er sends brownie points to @rationalcoding :sparkles: :thumbsup: :sparkles:
:cookie: 270 | @rationalcoding |http://www.freecodecamp.com/rationalcoding
lat = (position.coords.latitude)toFixed(2);
http://codepen.io/oshikurou/pen/amjvBd?editors=1012
so im curently working on the "SHOW THE LOCAL WEATHER" project and this is what i've done so far. Now i have to show the weather somehow.Can you help me on how im suppose to do that?
showWeather(dota.loc[0], dota.loc[1]);
at the end of getPosition$(document).ready(function() {getPosition();} );
// Call getPosition after document has finished loading
@Otto-AA http://codepen.io/oshikurou/pen/amjvBd?editors=1111
ok, i did something but i dont know if im getting closer or further.
function myFunction(arg1, arg2,...) {code;}
// or
var myFunction = function(arg1, arg2, ...) {code;}
getPosition()
) inside
@Otto-AA http://codepen.io/oshikurou/pen/amjvBd?editors=1111
okay now what? :P
dota.loc[0]
is not the thing you want. Do you know what type dota.loc is?
loc: "40.9397,24.4019",
`loc
(lat and lon)
.split
"any_string".split("_"); // -> ["any", "string"]
@Otto-AA http://codepen.io/oshikurou/pen/amjvBd?editors=1111
something like that?
console.log('lat: ' + lat + " | long: " + long);
to see how fine it works ^^ )
showWeather()
in your document.ready because it get called automatically by getPosition()
'
you also need to close it with '
(instead of your "+lat+"...
)
annunirmal sends brownie points to @otto-aa :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @otto-aa |http://www.freecodecamp.com/otto-aa
text-align: center;
for centering text
annunirmal sends brownie points to @otto-aa :sparkles: :thumbsup: :sparkles:
:warning: annunirmal already gave otto-aa points
@Otto-AA http://codepen.io/oshikurou/pen/amjvBd?editors=1012
what else should i change on js line 14?
'api.openweathermap.org/data/2.5/weather?+lat={'+lat+'}&lon={'+long+'}+570708ad4bd05b594cc91f17522bdc27'
[object Object]
as a weather :P why is that?
thodorisanta sends brownie points to @otto-aa :sparkles: :thumbsup: :sparkles:
:cookie: 309 | @otto-aa |http://www.freecodecamp.com/otto-aa
Object{ weather: [Object{ description: "clear sky", icon: "01d" }],
$("#weather").text(data.weather.description);
???
Object{ weather: [Object{ description: "clear sky", icon: "01d" }],
$("#weather").text(data.weather.description);
???
dongooden sends brownie points to @aprim05 :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @aprim05 |http://www.freecodecamp.com/aprim05
arr.pop();
$("#print").html(arr.join(""));
I replaced the backspace button icon with some value, and gave it a function to pop out the last element in arr.deadpool37 sends brownie points to @loccyone :sparkles: :thumbsup: :sparkles:
:cookie: 263 | @loccyone |http://www.freecodecamp.com/loccyone
font-size
wont listen to me. I suppose it has something to do with bootstrap but I have no clue.font-size
or font-family
as i see no rule for font-size
in your CSS?? And you linked Proza+Libre
font and using Open Sans
in your CSS file
font-size
in my css!
body {
font-family: "Proza Libre", sans-serif;
font-size: 1px;
}
font-size
to 1px
and still nothing changes.
#main-text
you need to do like below#main-text h3{
font-size: small;
}
font-size: 1px
of body it effected your ul
mariomeissner sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 609 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
p
tag inside blockquote
did not work because bootstrap already defined a most specific rule
app.use(static...
after your other routes, but that shouldn't give a not connected error
so to alter that font-size you need to target as
.jumbotron p{
font-size: small;
}
like above check in dev tools and override the rules as you require
recca004 sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 610 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
mariomeissner sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:warning: mariomeissner already gave vinaypuppal points
portifolio
like <div id='portifolio'>some content....</div>
so in navbar/navigation of your page add <a href='#portifolio'>Portifolio</a>
and when click on this link it will scroll till #portifolio
div
arminsuraj sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 611 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
<img src="pic_mountain.jpg" alt="Mountain View" style="width:304px;height:228px;">
encodeURIComponent
For eg: encodeURIComponent('https://vinaypuppal.com/c!;fj!')
you will get output as "https%3A%2F%2Fvinaypuppal.com%2Fc!%3Bfj!"
leapingmanx sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 876 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
knaguilar sends brownie points to @vinaypuppal and @leapingmanx :sparkles: :thumbsup: :sparkles:
:cookie: 262 | @leapingmanx |http://www.freecodecamp.com/leapingmanx
:cookie: 612 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
<div class= "flex-center col-md-4 col-md-offset-4">
<table>
<!-- Rest of your html -->
.flex-center{
display: flex;
justify-content: center;
align-items: center;
}
col-md-offset-4
instead of col-md-offset-5
mikail1998 sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 613 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
mikail1998 sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:warning: mikail1998 already gave vinaypuppal points
$('#iks').on('click', function(){
event handler, this is causing that problem
debugger;
statement inside click handler of x
and o
buttons and manually check execution of each step, this way may be you can find the actual issue
mikail1998 sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:warning: mikail1998 already gave vinaypuppal points
$(document).ready(function(){
$.ajax({
url: "https://api.fantasydata.net/soccer/v2/JSON/Areas?",
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","758c2f5bca5944db8182597aff60f0d2");
},
type: "GET",
// Request body
})
.done(function(data) {
alert("success");
console.log(data);
})
.fail(function() {
alert("error");
});
});
console.log(JSON.stringify(data));
robertridley1988 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 878 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
robertboan22 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 881 | @tylermoeller |http://www.freecodecamp.com/tylermoeller