arrudamt sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 429 | @gothamknight |http://www.freecodecamp.com/gothamknight
\(\d{3}\)
that would match for a three-digit group delimited by literal parentheses, or the \d{3}
- a three-digit group without parentheses. The matches are also saved, but that is just a side-effect in this case, not useful for anything else.
mtrivera sends brownie points to @gersho and @khaduch :sparkles: :thumbsup: :sparkles:
:cookie: 429 | @gersho |http://www.freecodecamp.com/gersho
:star2: 3293 | @khaduch |http://www.freecodecamp.com/khaduch
setInterval
/setTimeout
for the pomodoro clock project and the natural behavior of the browsers to ignore them while tab is out of focus?
function dropElements(arr, func) {
// Drop them elements.
var newArr = [];
for (var i=0; i<=arr.length; i++) {
if (func(arr[i])) {
newArr.push(i);
}
}
return newArr;
}
dropElements([1, 2, 3, 4], function(n) {return n >= 4;});
I feel like such a moron, but can someone please explain why this is returning "[3]" and not "[4]"?
newArr.push(arr[i])
instead
cowcrazy sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @iangracia |http://www.freecodecamp.com/iangracia
iangracia sends brownie points to @cowcrazy :sparkles: :thumbsup: :sparkles:
:cookie: 344 | @cowcrazy |http://www.freecodecamp.com/cowcrazy
cowcrazy sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 332 | @iangracia |http://www.freecodecamp.com/iangracia
korzo sends brownie points to @iangracia and @cowcrazy :sparkles: :thumbsup: :sparkles:
:cookie: 333 | @iangracia |http://www.freecodecamp.com/iangracia
:cookie: 345 | @cowcrazy |http://www.freecodecamp.com/cowcrazy
Hi guys, I need help with getting access to the wikipedia API. I get the classic cross-domain error when trying to fetch the data with axios:
XMLHttpRequest cannot load https://www.mediawiki.org/w/api.php. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access
Here is my code:
axios({
method: 'GET',
url: "https://commons.wikimedia.org/w/api.php",
crossDomain: true,
headers: { 'Api-User-Agent': 'Example/1.0' },
}).then(articles => console.log(articles))
.catch(error => console.log(error))
}
I tried the workaround where I preset the request with crossorigin.me, but that did not work. Help is very much appreciated.
gh05d sends brownie points to @cowcrazy :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @cowcrazy |http://www.freecodecamp.com/cowcrazy
gh05d sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 501 | @korzo |http://www.freecodecamp.com/korzo
let regex = /(\d{3}|\(\d{3}\))([0-9]{3}|-[0-9]{3})(\d{4}|-\d{4})/g;
function telephoneCheck(str) {
str = str.replace(/\s/g, '');
let test = regex.test(str);
if (str.length == 11 && str.charAt(0) == 1) {
str = str.slice(1);
if (test) {
return true;
}
} else if (str.length == 10 && test)
{
return true
} else
return false;
}
telephoneCheck("1 555 555 5555"); // should return true but returns undefined? =/
console.log(telephoneCheck("1 555 555 5555"));
let regex = /(\d{3}|\(\d{3}\))([0-9]{3}|-[0-9]{3})(\d{4}|-\d{4})/g;
function telephoneCheck(str) {
str = str.replace(/\s/g, '');
let test = regex.test(str);
console.log(str.length);
if (str.length == 11 && str.charAt(0) == 1) {
str = str.slice(1);
if (test) {
return true;
}
else return false;
} else if (str.length == 10 && test)
{
return true
} else
return false;
}
console.log(telephoneCheck("1 555-555-5555"));
telephoneCheck("1 555-555-5555"); // should return true but returns undefined? =/
str = str.slice(1);
does nothing
#image{
border-radius: 50px
}
victorja sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 431 | @gersho |http://www.freecodecamp.com/gersho
```function telephoneCheck(str) {
let regex = /(\d{3}|(\d{3}))([0-9]{3}|-[0-9]{3})(\d{4}|-\d{4})/g;
str = str.replace(/\s/g, '');
let match = str.match(/\d/g);
if (match.length == 11 && str.charAt(0) == 1) {
str = str.slice(1);
if (regex.test(str)) {
return true;
}
else return false;
} else if (match.length == 10 && regex.test(str))
{
return true;
} else
return false;
}
console.log(telephoneCheck("1 555-555-5555"));
telephoneCheck("1 555-555-5555");```
function telephoneCheck(str) {
let regex = /(\d{3}|\(\d{3}\))([0-9]{3}|-[0-9]{3})(\d{4}|-\d{4})/g;
str = str.replace(/\s/g, '');
let match = str.match(/\d/g);
if (match.length == 11 && str.charAt(0) == 1) {
str = str.slice(1);
if (regex.test(str)) {
return true;
}
else return false;
} else if (match.length == 10 && regex.test(str))
{
return true;
} else
return false;
}
console.log(telephoneCheck("1 555-555-5555"));
telephoneCheck("1 555-555-5555");
brianwilliams28 sends brownie points to @korzo and @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 502 | @korzo |http://www.freecodecamp.com/korzo
:cookie: 433 | @gersho |http://www.freecodecamp.com/gersho
prop
falls under this category)
"likes": ["Javascript", "Gaming", "Foxes"]
rylew0925 sends brownie points to @gersho and @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 434 | @gersho |http://www.freecodecamp.com/gersho
:cookie: 430 | @gothamknight |http://www.freecodecamp.com/gothamknight
victorja sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 431 | @gothamknight |http://www.freecodecamp.com/gothamknight
hifede sends brownie points to @konikodes :sparkles: :thumbsup: :sparkles:
:cookie: 397 | @konikodes |http://www.freecodecamp.com/konikodes
return contacts[x]["firstName"];
or
return contacts[x].firstName;
var prop = "firstName";
//all statements are the same
obj.firstName
obj["firstName"]
obj[prop]
rylew0925 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 436 | @gersho |http://www.freecodecamp.com/gersho
konikodes sends brownie points to @hifede :sparkles: :thumbsup: :sparkles:
#mydiv h4:nth-child(2)
<i>
is old school HTML4
<div id="followus" class="col-lg-4 col-md-4 col-sm-12 col-xs-12 nopaddinglr">
<h4 style="padding-left: 30%">FOLLOW US</h4>
<i style="padding-left: 30%" class="fa fa-5x fa-instagram" aria-hidden="true"></i><br><span style="padding-left: 30%">Instagram</span><br><br>
<i style="padding-left: 30%" class="fa fa-5x fa-facebook-official" aria-hidden="true"></i><br><span style="padding-left: 30%">Facebook</span>
</div>
#followus h4,
#followus i,
#followus span {
padding-left: 30%;
}
<div id="followus" class="col-lg-4 col-md-4 col-sm-12 col-xs-12 nopaddinglr">
<h4>FOLLOW US</h4>
<i class="fa fa-5x fa-instagram" aria-hidden="true"></i>
<div>Instagram</div>
<i class="fa fa-5x fa-facebook-official" aria-hidden="true"></i>
<div>Facebook</div>
</div>
#followus {
padding-left: 30%;
}