get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
var myBool;
$.getJSON(weatherapi, function() {
myBool = false;
}).then(function() {
console.log(myBool); //false
});
console.log(myBool) //undefined
:star2: 2500 | @skyc0der |http://www.freecodecamp.com/skyc0der
danii956 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
target="_blank"
to the URLs you create in your javascript
"<a href='" + data[3][i] + "' target='_blank'>"
braillon7 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2501 | @skyc0der |http://www.freecodecamp.com/skyc0der
$('#output').prepend(
"<li>" +
"<a href='" + data[3][i] + "' target='_blank'>" + data[1][i] + "</a>" +
"<p>"+data[2][i]+"</p>" +
"</li>"
);
<a>
link is, and which tags are open/closed
These are the ones:
area, base, br, col, embed, hr, img, input, keygen, link, menuitem, meta, param, source, track, wbr
<a>
was self closing how would you include the element to be linked?
iamrkcheers sends brownie points to @sgoldber61 :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @sgoldber61 |http://www.freecodecamp.com/sgoldber61
iamrkcheers sends brownie points to @sgoldber61 :sparkles: :thumbsup: :sparkles:
:warning: iamrkcheers already gave sgoldber61 points
iamrkcheers sends brownie points to @sgoldber61 :sparkles: :thumbsup: :sparkles:
:warning: iamrkcheers already gave sgoldber61 points
hello
i have a query,
I was making RANDOM QUOTE GENERATOR
and i dont know how to put a text box displaying the quote in the middle of the page
transition
prakashyadav008 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2502 | @skyc0der |http://www.freecodecamp.com/skyc0der
form.submit = () => { // code };
The above is the same as:form.submit = function() { // code };
arguments
or this
objects
document.getElementById("form").onsubmit
$("#form").on("submit", function() {
.addEventListener('submit', function() {
:active
psuedo selector, but it is only applied when the mouse button is down
:focus
#search-bar:focus{
width:300px;
}
#search-bar:focus{
width:300px;
}
#search-bar:hover{
width:300px;
}
<div class="section1">
<input id="search-bar" placeholder="Search"></input>
<div>animation</div>
</div>
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6445 | @manish-giri |http://www.freecodecamp.com/manish-giri
darrenfj sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2503 | @skyc0der |http://www.freecodecamp.com/skyc0der
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1978 | @darrenfj |http://www.freecodecamp.com/darrenfj
skyc0der sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1979 | @darrenfj |http://www.freecodecamp.com/darrenfj
Does anyone know how to add 'a:hover' property onto a tag in the 'render()' function of a react component class.
class Developer extends React.Component {
render() {
const style = {
h4 : {
fontFamily : 'Open Sans Condensed'
},
a : {
color : 'purple',
textDecoration : 'none'
}
};
return (
<h4 style={style.h4}>
<a>
Rishabh Kashyap
</a>
</h4>
);
}
}
Any help is appreciated. Thank You.
var myGlobalScope();
is invalid - remove the var
(not sure why you changed this line).
koder3 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8343 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
npm run build
, so in order to update it, do I have to delete build folder first and then run npm run build
again?
minutes
to minutes : seconds
in my pomodoro clock app. Can anyone please help. I found some method on stackOverflow but it won’t work.
setInterval(sessionCount, 1000)
to setInterval(sessionCount, 60000)
iamrkcheers sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8346 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
mukeshangrish sends brownie points to @ace1122sp :sparkles: :thumbsup: :sparkles:
:cookie: 399 | @ace1122sp |http://www.freecodecamp.com/ace1122sp
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
recent: [],
alltime: []
};
}
componentDidMount(){
const ajaxReqs = (url) => {
const request = new XMLHttpRequest();
request.open('GET', url, true);
request.send();
request.onload = () => {
if (request.status >= 200 && request.status < 400) {
var data = JSON.parse(request.responseText);
console.log(data);
return data;
}
};
}
this.setState({
recent: ajaxReqs('https://fcctop100.herokuapp.com/api/fccusers/top/recent'),
alltime: ajaxReqs('https://fcctop100.herokuapp.com/api/fccusers/top/alltime')
});
}
render(){
return(
<p>{this.state.recent[0]}</p>
)
}
}
ReactDOM.render(<App/>, document.querySelector(".content"));
vas seconds = 60;
and with setInterval to 1000ms, you do something like this seconds -= 1;
and when your variable seconds comes to 0, then you call some function which decrease your minutes by 1 and set variable seconds back to 60..
margin:0;
on line 3
5millerk sends brownie points to @ace1122sp :sparkles: :thumbsup: :sparkles:
:cookie: 400 | @ace1122sp |http://www.freecodecamp.com/ace1122sp
minutes
to minutes : seconds
. But looks like I jinxed it. Please help
minutes
to minutes : seconds
problem that’s bugging me right now
var clockState = 0;
function startOrStopClock(){
if(clockState) {
//stop time
clockState = 0;
} else {
//start time
clockState = 1;
}
I did something like that in my app
if(clockState) is true
mukeshangrish sends brownie points to @ace1122sp :sparkles: :thumbsup: :sparkles:
:cookie: 401 | @ace1122sp |http://www.freecodecamp.com/ace1122sp
var now = new Date().getTime();
var distance = countDownDate - now;
var countDownDate = new Date().getTime()+time*60*1000;
var now = new Date().getTime();
var distance = countDownDate - now;
:cookie: 304 | @artbohr |http://www.freecodecamp.com/artbohr
mukeshangrish sends brownie points to @artbohr :sparkles: :thumbsup: :sparkles:
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
$("#timer").on("click", function() {
$(".row").hide();
seconds = 60; //convert minutes to seconds
var sessionTimer = setInterval(sessionCount, 1000);
//start counter which performs a function every 1000 milliseconds
function sessionCount() {
$("#status").html("Session");
seconds -= 1; //decrease count by 1 every second
$("#timer").toggleClass("timer-border-green");
$("#timer").toggleClass("timer-border-yellow");
if(sessionTime % 60 >= 10)
showStr = Math.floor(sesionTime / 60) + ":" + (sessionTime % 60);
else
showStr = Math.floor(sesionTime / 60) + ":0" + (sessionTime % 60);
//$("#time").html(sessionTime);
//Once the sessionTime becomes zero we start the breakTime
if(sessionTime < 1) {
clearInterval(sessionTimer);
//once the sessionCount has ended reset the value automatically
sessionTime = parseInt($("#session").html());
breakTime *= 60;
var breakTimer = setInterval(breakCount, 1000);
//similar thing for breakCount
function breakCount() {
$("#status").html("Break");
breakTime -= 1;
$("#timer").toggleClass("timer-border-red");
$("#timer").toggleClass("timer-border-blue");
if(sessionTime % 60 >= 10)
showStr = Math.floor(sesionTime / 60) + ":" + (sessionTime % 60);
else
showStr = Math.floor(sesionTime / 60) + ":0" + (sessionTime % 60);
//$("#time").html(breakTime);
if(breakTime < 1) {
clearInterval(breakTimer);
breakTime = parseInt($("#break").html());
$(".row").show();
sessionTimer = setInterval(sessionCount, 1000);
}
}
}
};
});
sessionTime *= 60; //convert minutes to seconds
var sessionTimer = setInterval(sessionCount, 1000);
//start counter which performs a function every 1000 milliseconds
function sessionCount() {
$("#status").html("Session");
sessionTime -= 1; //decrease count by 1 every second
$("#timer").toggleClass("timer-border-green");
$("#timer").toggleClass("timer-border-yellow");
var minutes = Math.floor(sessionTime/60);
var seconds = Math.floor(sessionTime%60);
$.getJSON
or new XMLHttpRequest();
or using$.ajax
koder3 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3599 | @moigithub |http://www.freecodecamp.com/moigithub
[3,4]
even though it is less than 5. like whaatt?? crazzyyy bro!
function dropElements(arr, func) {
for(var i=0; i<arr.length; i++){
if(func(arr[0])){
break;
}else{
arr.shift();
}
}
return arr;
}
dropElements([1, 2, 3, 4], function(n) {return n > 5;}); //should return [].
artoodeeto sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 518 | @longnt80 |http://www.freecodecamp.com/longnt80