Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
Ademola Adegbuyi
@ooade
@tariellaelius 'use strict' is not to be declared as a variable... It can be placed globally, inside functions.. It's a way a saying, go on with best practice and warn me or don't work if i try to go berserk
@TSIIAM You don't need to create any variable, you'll just assign the value to result
Beeleyt350
@Beeleyt350

```function myLocalScope() {
'use strict';
var myVar= 10;

console.log(myVar);

}
myLocalScope(myVar);

// Run and check the console
// myVar is not defined outside of myLocalScope

// Now remove the console log line to pass the test```

Alvaromesa
@TSIIAM
hmm let me see how.
Ademola Adegbuyi
@ooade
@TSIIAM You did Object lookup recently right?
Tariyel Hamidov
@tariellaelius
@Beeleyt350 Did you try removing the console.log line?
As it says in the instructions?
Beeleyt350
@Beeleyt350
@waynebunch . How do i put my code into the forum like you have? it is in the black box.
Alvaromesa
@TSIIAM
@ooade I did the lesson to assign object properties with values
Manish Giri
@Manish-Giri
@Beeleyt350 console.log(myVar);
they probably want you to delete this line at the end.
Beeleyt350
@Beeleyt350
@tariellaelius yep, but nothing happened when I clicked run
Manish Giri
@Manish-Giri

@Beeleyt350

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);
// Now remove the console log line to pass the test

Ademola Adegbuyi
@ooade
@TSIIAM Yeah, you just need to apply that
Beeleyt350
@Beeleyt350
@Manish-Giri just deleted it. It says " console.log never called
Tariyel Hamidov
@tariellaelius
@Beeleyt350 It doesn't say that you should asssign a value to the variable.
Wayne Bunch
@waynebunch
@Beeleyt350 do three backticks (```), hit shift + enter. It will create a newline and three new backticks. Paste the code in blank line. After pasted, hit control + enter to send
Tariyel Hamidov
@tariellaelius
Remove the =10 part
Srđan Međo
@PerpetualWar
@tariellaelius $.getJSON("apiurl", function(){console.log(); var cache = {};})
Alvaromesa
@TSIIAM
@ooade example ```
Srđan Međo
@PerpetualWar
that console.log() does nothing
Alvaromesa
@TSIIAM
var playerNumber = 16;     // Change this Line
var player = testObj[playerNumber];   // Change this Line
console.log(playerNumber);
Srđan Međo
@PerpetualWar
what should be argument ?
Alvaromesa
@TSIIAM
I need to use something like that in this lesson right?
Tariyel Hamidov
@tariellaelius
@PerpetualWar $.getJSON("apiurl", function(json){console.log(json); var cache = {};})
Ademola Adegbuyi
@ooade
@TSIIAM exactly
Eivind
@NonDesistas
how do I return .push and .shift in the same function?
Jason Luboff
@JLuboff
@NonDesistas .push() does not return anything
@NonDesistas .push is used to push an item into an array
Manish Giri
@Manish-Giri
technically, .push() returns the length of the new array
but irrelevant here.
Wayne Bunch
@waynebunch

let getData = new Promise(function(resolve, reject){
    let postArray = [];
    let usersArray = [];
    let postsAPI = 'url';
    let userAPI = 'url';

    $.when(
        $.getJSON(postsAPI),
        $.getJSON(userAPI)
    ).done(function(postData, userData) {
        // postArray.push(postData[0]);
        // usersArray.push(userData[0]);
        postData.forEach(data => postArray.push(data));
        userData.forEach(data => usersArray.push(data));
    });
    //
    if (resolve) {
        resolve(postArray);
    } else {
        reject('failed');
    }

});

getData.then(function(data) {
    testArray = [1,2,3];
    // let mainContent = document.getElementById('mainContent');
    // let newArticle = document.createElement('article');
    // let newSection = document.createElement('section');
    // let newH1 = document.createElement('h1');
    // postArray.forEach(data => console.log(data));
    console.log(data, testArray[1]);
})
Here's my code, new to promises. Does anyone see anything wrong with this? My console.log(data, testArray[1]; shows the data it gets back. However, I'm unable to access data[0] or data[1] using JS.
Tariyel Hamidov
@tariellaelius
@PerpetualWar btw, if you are using OpenWeatherApi, keep in mind that it won't work on most browsers(but it will work on desktop FireFox, at least), due to the fact that free account for that API provides data only over http, but in order to request geolocation data you need everything on the page to fetch data over https.
Beeleyt350
@Beeleyt350
function myLocalScope() {
  'use strict';
 var myVar;


  console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope



// Now remove the console log line to pass the test
Wayne Bunch
@waynebunch
it says undefined
Jason Luboff
@JLuboff
@Manish-Giri I stand corrected. Thank you for pointing that out
CamperBot
@camperbot
:star2: 3934 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
haha
CamperBot
@camperbot
jluboff sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
Manish Giri
@Manish-Giri
ty for the cookie @JLuboff
CamperBot
@camperbot
manish-giri sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 676 | @jluboff |http://www.freecodecamp.com/jluboff
Beeleyt350
@Beeleyt350
I still can't seen to get it to work. I have deleted the console log but that did not work. Any other ideas
Alvaromesa
@TSIIAM

// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var lookup = {
     "alpha":"Adams",
      "bravo":"Boston",
    "charlie":"Chicago",
      "delta":"Denver",
     "echo":"Easy",
      "foxtrot":"Frank",


  };

   var phoneticLetter = "Charlie";
  var phonetic = phoneticLetter;
  var result = phonetic;


  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("delta");
Manish Giri
@Manish-Giri
@Beeleyt350 post your challenge URL here, click "run tests" first.
Beeleyt350
@Beeleyt350
@tariellaelius thank you for your help so far
CamperBot
@camperbot
beeleyt350 sends brownie points to @tariellaelius :sparkles: :thumbsup: :sparkles:
:cookie: 275 | @tariellaelius |http://www.freecodecamp.com/tariellaelius
Alvaromesa
@TSIIAM
That seems wrong.
Beeleyt350
@Beeleyt350
@Manish-Giri thank you also