These are chat archives for FreeCodeCamp/HelpJavaScript

20th
Apr 2018
NikolaNbgd
@NikolaNbgd
Apr 20 2018 07:47

Hello guys. I am trying to submit some form data to date base, but when I start to type, I am getting this error

Uncaught TypeError: Cannot read property 'form' of undefined

also, that error appears as many times as I press some key on keyboard. Does anyone know why?

Blauelf
@Blauelf
Apr 20 2018 08:09
Your JavaScript is using property "form" of an object that isn't there. If you have a line number (and the code isn't minified, with all code being line 1), you could see if you can find the source of that undefined value. Something I think is a flaw of JavaScript is its soft-fails. Accessing a non-existent property of an (existing) object returns undefined (which can also be the value of an existing property!). This, or a non-initialised variable, likely happened to you. Often such a property is non-existent due to a spelling error, like upper vs. lowercase.
NikolaNbgd
@NikolaNbgd
Apr 20 2018 08:16
@Blauelf can this affect to my post submit request?
Stephen James
@sjames1958gm
Apr 20 2018 09:21
@NikolaNbgd It certainly could, but without more information it is hard to tell.
you can always use the devtools network tab to see the contents of your post request.
NikolaNbgd
@NikolaNbgd
Apr 20 2018 09:23
@sjames1958gm I am getting success in console when button is clicked
Stephen James
@sjames1958gm
Apr 20 2018 09:26
@NikolaNbgd It all depends on what "success" meant to whoever coded that message.
NikolaNbgd
@NikolaNbgd
Apr 20 2018 09:36
@sjames1958gm my script works like a charm, I just checked data base, it is full with data that I sent, I am just thinking how to remove that error from console
Stephen James
@sjames1958gm
Apr 20 2018 09:37
@NikolaNbgd Since it is on every keypress, sounds like there is a on change or on keypress handler that is broken
NikolaNbgd
@NikolaNbgd
Apr 20 2018 09:55
@sjames1958gm yep, it seems like that, I have one keypress function that doesn't do anything right now, maybe that causing the error
Rajat
@rajataudichya
Apr 20 2018 11:09

function bouncer(arr) {
  // Don't show a false ID to this bouncer.


var mArr = arr.filter(function(obj){

  return obj === "" && obj === false && obj === "" && obj === 0 &&  obj === null; 
});


return mArr;
}



bouncer([7, "ate", "", false, 9]);
i believe the way I have applied the filter function is wrong?
@Blauelf yesterday you said that in the challenge i dont need to use the split function if you remember
in the mutation challenge
Markus Kiili
@Masd925
Apr 20 2018 11:11
@rajataudichya There is never any reason to list all the falsy values. A simple test for a truthy value is if(val){...}
Rajat
@rajataudichya
Apr 20 2018 11:11
@Masd925 Let me try
function mutation(arr) {


var word1 = arr[0].toLowerCase();

var word2 = arr[1].toLowerCase();

for (var i = 0; i < word2.length; i++){

  var fArr = word1.indexOf(word2[i]);

    if(fArr < 0 ){

      return false;
    }

}

  return true;

} 

mutation(["hello", "hyo"]);
sorry wrong code
@Masd925 can you show an example ?
Markus Kiili
@Masd925
Apr 20 2018 11:17
@rajataudichya You could do if(obj) return true; return false inside filter or even simpler ways exist.
Both return Boolean(obj); and return obj; do work.
Blauelf
@Blauelf
Apr 20 2018 11:20

@rajataudichya Yes, you don't need split since string's indexOf function works the same for single characters. This code works? Looks right to me.

And on filter function for falsy bouncer... It would have to be !== all the time, and you're missing a check for NaN (which is tricky!). Better use the definition of truthy/falsy, like @Masd925 suggested.

Rajat
@rajataudichya
Apr 20 2018 11:22
@Blauelf Thanks need to check filter function in details as the filter challenge I complete only had to filter values >5
CamperBot
@camperbot
Apr 20 2018 11:22
rajataudichya sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4693 | @blauelf |http://www.freecodecamp.org/blauelf
Rajat
@rajataudichya
Apr 20 2018 11:30

function bouncer(arr) {
  // Don't show a false ID to this bouncer.


 arr = arr.filter(function(obj){



    return (obj !== "" && obj !== 0 && obj !== undefined && obj !== false && obj != null && !isNaN(obj));




});


return arr;
}



bouncer([false, null, 0, NaN, undefined, ""]);
why this isn't working
and really not understanding what is truthy and fasly...:P
Markus Kiili
@Masd925
Apr 20 2018 11:31
@rajataudichya isNaN() is not a test for value NaN. The obj===obj would test obj for not being NaN.
Because NaN is the only JS value unequal to itself.
Also change obj != null into obj !==null
Rajat
@rajataudichya
Apr 20 2018 11:34
I wish i could understand what you just said let me try harder...
Markus Kiili
@Masd925
Apr 20 2018 11:35
@rajataudichya ES6 JS also has Number.isNaN(val) that really tests for value NaN.
@rajataudichya All JS values are equal to themself, except NaNwhich is unequal to any value, even to itself. So NaN===NaN is false. Therefore you can use val===val for testing if a variable is NaN. That condition is false only for NaN and true for all other values.
So val===val means is val not NaN, and val!==val means is val NaN.
Blauelf
@Blauelf
Apr 20 2018 11:40
So many weird things in JavaScript :D (also see for example https://dorey.github.io/JavaScript-Equality-Table/)
isNaN first converts the argument to a number, then checks whether the result is NaN. This means that it for example will return true for any non-numeric string.
ES6's Number.isNaN just tests for NaN, without any conversion.
Markus Kiili
@Masd925
Apr 20 2018 11:41
-> isNaN is not really used too much.
or used with a type number check which makes it do the same as Number.isNaN()
Rajat
@rajataudichya
Apr 20 2018 11:48
Thanks @Blauelf and @Masd925 for your support :)
CamperBot
@camperbot
Apr 20 2018 11:48
rajataudichya sends brownie points to @blauelf and @masd925 :sparkles: :thumbsup: :sparkles:
api offline
:star2: 4787 | @masd925 |http://www.freecodecamp.org/masd925
Rajat
@rajataudichya
Apr 20 2018 11:49
I believe this will take some time
Blauelf
@Blauelf
Apr 20 2018 11:51
I think it's weird to have to write obj === obj. Also, it's weird to have typeof NaN === "number", since NaN means "Not a Number" :D
(but knowing floating point numbers, that one's actually not surprising)
Stephen James
@sjames1958gm
Apr 20 2018 11:54

@rajataudichya Forgetting NaN for now, which is an effed up value

if (value) {
   console.log("truthy")
} else {
   console.log("falsy")
}

The if statement will convert valueto boolean (true or false)
Truthy values are converted to true
Falsy values are converted to false
The falsy values are listed in the challenge (false, null, 0, NaN, undefined, "") - every other value is truthy
There are other ways to convert a value to boolean
Boolean(value) this function Boolean will convert value to boolean

@rajataudichya Since Boolean is a function that converts values to boolean and filter expects a boolean
arr.filter(Boolean) will accomplish the task of removing falsy values from arr
Rajat
@rajataudichya
Apr 20 2018 12:02
@sjames1958gm Thanks m8
CamperBot
@camperbot
Apr 20 2018 12:02
rajataudichya sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9216 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Apr 20 2018 12:03
@rajataudichya :+1:
tundeiness
@tundeiness
Apr 20 2018 12:15
hi all i'm working on the twitchtv API currently and I was trying to see if I could log some results from the API call but i'm not getting anything. What could be the problem?
Markus Kiili
@Masd925
Apr 20 2018 12:16
@tundeiness Have you checked the browser developer tools console for errors?
tundeiness
@tundeiness
Apr 20 2018 12:17
@Masd925 the only error i'm getting is from the API call
Markus Kiili
@Masd925
Apr 20 2018 12:17
@tundeiness What is the error?
tundeiness
@tundeiness
Apr 20 2018 12:17
@Masd925 speaking of that, how do I access that? or are you referring to chrome's developer tool? cos i'm using chrome.
Markus Kiili
@Masd925
Apr 20 2018 12:18
@tundeiness Yes the developer tools console.
tundeiness
@tundeiness
Apr 20 2018 12:18
@Masd925 the error message I predefined in the API call..eg "something went wrong"
@Masd925 but let me ask, is it possible to embed an API call in a for loop?
Markus Kiili
@Masd925
Apr 20 2018 12:19
@tundeiness Yes.
tundeiness
@tundeiness
Apr 20 2018 12:20
@Masd925 well, stage one crossed successfully...now to find out why i'm not getting any result.
@Masd925 so i'm getting failed to load resources error..
Stephen James
@sjames1958gm
Apr 20 2018 12:23
@tundeiness If you put it in a for loop you will get several requests at once and responses coming back could be in different order.
Also, there are further issues with for loops and async (API) calls
http://stackoverflow.com/questions/750486/javascript-closure-inside-loops-simple-practical-example
tundeiness
@tundeiness
Apr 20 2018 12:23
@Masd925
Uncaught SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Function.Z.parseJSON (everypage-c75243464228cc81b9c36cde0614dcac30e07deebaf11ddb7251e57d360bc8ef.js:3)
    at Object.error (everypage-c75243464228cc81b9c36cde0614dcac30e07deebaf11ddb7251e57d360bc8ef.js:5)
    at l (everypage-c75243464228cc81b9c36cde0614dcac30e07deebaf11ddb7251e57d360bc8ef.js:2)
    at Object.fireWith [as rejectWith] (everypage-c75243464228cc81b9c36cde0614dcac30e07deebaf11ddb7251e57d360bc8ef.js:2)
    at n (everypage-c75243464228cc81b9c36cde0614dcac30e07deebaf11ddb7251e57d360bc8ef.js:3)
    at XMLHttpRequest.<anonymous> (everypage-c75243464228cc81b9c36cde0614dcac30e07deebaf11ddb7251e57d360bc8ef.js:3)
@sjames1958gm ookay....
Markus Kiili
@Masd925
Apr 20 2018 12:24
@tundeiness Are you sure that the response text is json?
tundeiness
@tundeiness
Apr 20 2018 12:25
@sjames1958gm but it looks as if the twitchtv task , one cannot avoid doing that? or maybe I have not done my research very well?
@Masd925 yes...I set dataType in the API call to "json"
Stephen James
@sjames1958gm
Apr 20 2018 12:26
@tundeiness You can use a different loop (forEach) for example. It is not that you can't do it you have to be aware of the
fact that you have multiple requests happening at once
@tundeiness Use your devtools network tab to see the contents of the response to your request.
Make it work for one request first then add more
tundeiness
@tundeiness
Apr 20 2018 12:27
@sjames1958gm okay. I really don't know the difference between for loop and foreach...aren't they doing the same stuff?
@sjames1958gm nice tip..was actually thinking about that
Stephen James
@sjames1958gm
Apr 20 2018 12:28
@tundeiness That link explains it better than I can in chat. Has to do with closure.
tundeiness
@tundeiness
Apr 20 2018 12:29
@sjames1958gm okay..
Markus Kiili
@Masd925
Apr 20 2018 12:29
@tundeiness Usually for loop and forEach are both options. For loop you can terminate, which makes it a bit more powerful.
tundeiness
@tundeiness
Apr 20 2018 12:31
@Masd925 that's why I prefer for loop than foreach....
Ken Haduch
@khaduch
Apr 20 2018 13:27
@tundeiness @Masd925 - I was curious about the ability to exit a .forEach() method, and found this stackoverflow - it mentions the Array.some() method, as well as Array.every() - so those are other "looping" methods that do break on a true or false condition... just some food for thought? I guess it depends on the operation you are trying to perform within the loop... but you probably knew about all of those. It just gives a slightly different perspective on it.
Chris
@ConnectCodes
Apr 20 2018 13:28
:wave:
Ken Haduch
@khaduch
Apr 20 2018 13:30
@ConnectCodes :wavy_dash: :wave: :wavy_dash:
Chris
@ConnectCodes
Apr 20 2018 13:32
@khaduch how’s it going? Almost weekend :smile:
Rajat
@rajataudichya
Apr 20 2018 13:32

function destroyer(arr) {
  // Remove all the values
  var farg = arguments[0];


var done =  farg.filter(function(val){

      for(var i = 1; i > arguments.length; i++){
      return val != arguments[i];

      }

    });



return done;




}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Ken Haduch
@khaduch
Apr 20 2018 13:32
@ConnectCodes - going okay... not going to be spending too much time at the computer, going to run out to do some errands. Other than that, going okay, finally have a day with no snow or rain! :)
How are you doing?
Rajat
@rajataudichya
Apr 20 2018 13:32
what am I doing wrong?>
I want to remove the arguments from the array
Ken Haduch
@khaduch
Apr 20 2018 13:34
@rajataudichya - taking a look...
Aditya
@ezioda004
Apr 20 2018 13:35
@rajataudichya arguments object inside the .filter() would refer to the callback function, not the destroyers()
Ken Haduch
@khaduch
Apr 20 2018 13:36
@rajataudichya - you'll probably find that you are not looking through all of the arguments (which, as @ezioda004 is pointing out you should save in a separate variable) before making a return. So it could be falsely returning on the wrong value.
Chris
@ConnectCodes
Apr 20 2018 13:38
@khaduch yeah it’s finally sunny here too will try enjoy the sun this weekend and not worry about the final projects :smile:
tundeiness
@tundeiness
Apr 20 2018 13:38
the feed back on the twitchtv API project is confusing...can anyone kindly update me with the latest approach to the project?...I intend using ajax please.
Aditya
@ezioda004
Apr 20 2018 13:41
@tundeiness Make a GET request as explained in this page? https://wind-bow.glitch.me/
tundeiness
@tundeiness
Apr 20 2018 13:42
@ezioda004 well I did..nothing was logged
Aditya
@ezioda004
Apr 20 2018 13:43
@tundeiness Can you show what you've attempted? Because the API seems to be working. Here's an example https://wind-bow.glitch.me/twitch-api/channels/thijsnl
Ken Haduch
@khaduch
Apr 20 2018 13:44
@rajataudichya - you can make a copy of the arguments using var args = Array.from(arguments,1); and then use that within the loop (you will then have an array of only the "extra" argument values, so you don't have to use var i = 1), but you have to really pay attention to what is happening inside the loop. Make that change, using args inside the loop, and try going to http://pythontutor.com/javascript.html and play around with it...
tundeiness
@tundeiness
Apr 20 2018 13:44

@ezioda004 I am using this instead

https://wind-bow.glitch.me/twitch-api/users/

any difference between the one you suggested?

Aditya
@ezioda004
Apr 20 2018 13:47
@tundeiness That also works, the only difference is you get some different data from the two endpoints. I dont remember exactly what data is different but I ended up making 3 GET requests from each endpoint mentioned when I made the project. Also, here's the example of the endpoint you posted https://wind-bow.glitch.me/twitch-api/users/thijsnl
tundeiness
@tundeiness
Apr 20 2018 13:48
@ezioda004
$(document).ready(function() {

   users =  "ESL_SC2";
   var baseUrl = "https://wind-bow.gomix.me/twitch-api/users/";

      var tailUrl = users;

     var webLink = baseUrl+tailUrl;

    $.ajax ({
       Url :webLink,
          type:"GET",
          dataType:"json",
          success : function (data){
            console.log( data );
         }


    });

});
Ken Haduch
@khaduch
Apr 20 2018 13:48
@ConnectCodes - enjoy the sun and have a great weekend!
tundeiness
@tundeiness
Apr 20 2018 13:49
@ezioda004 i really do want to have a twitch API key to do this...
Chris
@ConnectCodes
Apr 20 2018 13:50
@khaduch Thanks have a nice weekend away from the pc!
CamperBot
@camperbot
Apr 20 2018 13:50
connectcodes sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3891 | @khaduch |http://www.freecodecamp.org/khaduch
Aditya
@ezioda004
Apr 20 2018 13:51
@tundeiness In Url U should be lowercase
tundeiness
@tundeiness
Apr 20 2018 13:52
@ezioda004 really ? case issues? sigh...let me try that please.
@ezioda004 not logging any data
Aditya
@ezioda004
Apr 20 2018 13:53
@tundeiness Any error in the console?
     var webLink = "https://wind-bow.glitch.me/twitch-api/channels/thijsnl"

    $.ajax ({
       url :webLink,
          type:"GET",
          dataType:"json",
          success : function (data){
            console.log( data );
         }
    });
This seems to be working
tundeiness
@tundeiness
Apr 20 2018 13:54
@ezioda004
Failed to load https://wind-bow.gomix.me/twitch-api/users/ESL_SC2: Redirect from 'https://wind-bow.gomix.me/twitch-api/users/ESL_SC2' to 'https://wind-bow.glitch.me/twitch-api/users/ESL_SC2' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access.
@ezioda004 this worked
"https://wind-bow.glitch.me/twitch-api/users/";

@ezioda004

https://wind-bow.gomix.me/twitch-api/users

this has issues.

Aditya
@ezioda004
Apr 20 2018 13:57
Yeah, the other one is problematic, atleast the other one is working!
Rajat
@rajataudichya
Apr 20 2018 13:59
THE LOOP IS NOT WORKING HERE

function destroyer(arr) {
  // Remove all the values
  var farg = arguments[0];

  var one = arguments.length;

  var fArr= [];


  for(var i = 1; i > 3; i++){

    var dot = i;
   fArr.push(dot);
      }

    return fArr;  





}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
data is not being pushed in fArr variable
ehutchllew
@ehutchllew
Apr 20 2018 14:01
@rajataudichya you set your initial iteration to i=1, but the condition is that the loop will only run when i > 3.
alpox
@alpox
Apr 20 2018 14:02
@rajataudichya var i = 1; i > 3; i++ you loop as long as i is bigger than 3 - which it never is, so the loop is never entered. (i starts with 1 which is smaller than 3)
Rajat
@rajataudichya
Apr 20 2018 14:02
OMG!!! that common mistake again
sorry guys....
Ken Haduch
@khaduch
Apr 20 2018 14:08
@ConnectCodes - thanks - cheers to you and chat with you again soon... happy coding, too! :)
CamperBot
@camperbot
Apr 20 2018 14:08
khaduch sends brownie points to @connectcodes :sparkles: :thumbsup: :sparkles:
api offline
Markus Kiili
@Masd925
Apr 20 2018 14:08
@khaduch Yes, I was talking about just forEach (vs for).
NikolaNbgd
@NikolaNbgd
Apr 20 2018 14:10

Hi guys, I need quick help, I am trying to valite input for UK phone number, like this

pattern="^\+?[1-9]\d{1,14}$"

but I got this error in console

Pattern attribute value ^+?[1-9]d{1,14}$ is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /^+?[1-9]d{1,14}$/: Nothing to repeat

Does anyone know why?

Ken Haduch
@khaduch
Apr 20 2018 14:11
@Masd925 - yes, but I haven't used .some() and .every() very often, so it was good to be reminded of them, and in a way it is a looping method that "breaks" the loop on a condition. I figured that you already knew, probably more of a helpful reminder for me than for you... :)
@rajataudichya - http://pythontutor.com/javascript.html - did you try that site? It's a great debugging tool!
Rajat
@rajataudichya
Apr 20 2018 14:16
@khaduch actually I didn't I am busy completing the challenges
Will try it soon
Blauelf
@Blauelf
Apr 20 2018 14:37

@NikolaNbgd You probably didn't escape the backslashes. Like "^\\+?[1-9]\\d{1,14}$".

Gets weird if you want to include a literal backslash, that would have to be escaped for RegExp, and also for string, so four backslashes in code. A regex matching \, so /\\/, as a string is "\\\\".

Jason Luboff
@JLuboff
Apr 20 2018 15:14
:wave:
Markus Kiili
@Masd925
Apr 20 2018 15:15
:sparkles:
Jason Luboff
@JLuboff
Apr 20 2018 15:16
@Masd925 Whats up
Markus Kiili
@Masd925
Apr 20 2018 15:16
@JLuboff Finishing up the old job. Learning Clojure.
How about you?
Rajat
@rajataudichya
Apr 20 2018 15:17
Can someone please explain me this I am trying to solve seek and destroy

function destroyer() {
var arr = arguments[0];
var params = [];

// Create array of all elements to be removed
for (var k = 1; k < arguments.length; k++)
params.push(arguments[k]);

// return all not matching values
return arr.filter(function(item) {
return params.indexOf(item) < 0;
});
}

console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));

```jsfunction destroyer() {
var arr = arguments[0];
var params = [];

// Create array of all elements to be removed
for (var k = 1; k < arguments.length; k++)
params.push(arguments[k]);

// return all not matching values
return arr.filter(function(item) {
return params.indexOf(item) < 0;
});
}

console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));```

tundeiness
@tundeiness
Apr 20 2018 15:19
is there any other way to get streaming status in the twitchtv API without using .../streams/username ?
Jason Luboff
@JLuboff
Apr 20 2018 15:20
@Masd925 I thought you were already done with your old job? Just got into work...it's friday which is nice
@tundeiness I haven't looked at the API in quite a while, but from what I remember, no, you have to use the two different end points to get different information
tundeiness
@tundeiness
Apr 20 2018 15:22
@JLuboff wow..meaning two API calls?
Jason Luboff
@JLuboff
Apr 20 2018 15:22
@tundeiness Correct
Christopher McCormack
@cmccormack
Apr 20 2018 15:22
@rajataudichya heya - put the backticks on their own line so we can read it easier:
```
code
```
tundeiness
@tundeiness
Apr 20 2018 15:22
@JLuboff :(
Jason Luboff
@JLuboff
Apr 20 2018 15:22
@tundeiness It aint that bad ;)
tundeiness
@tundeiness
Apr 20 2018 15:23
@JLuboff how to pull that off....:(
Markus Kiili
@Masd925
Apr 20 2018 15:23
@JLuboff About two weeks still to do and then two weeks of vacation/studying before the new job starts.
Rajat
@rajataudichya
Apr 20 2018 15:23
Chris I am chatting from my cellphone
Jason Luboff
@JLuboff
Apr 20 2018 15:23
@tundeiness You just need to make two API calls (two ajax/json/fetch/whatever)
tundeiness
@tundeiness
Apr 20 2018 15:24
@JLuboff roight....I can see me for loop breaking things
Christopher McCormack
@cmccormack
Apr 20 2018 15:26
@rajataudichya ok what's your question? It seems to be working but I don't 100% remember the exercise - are you just removing all additional arguments after the first argument from the first argument array?
Markus Kiili
@Masd925
Apr 20 2018 15:26
@JLuboff There is quite fast paced two month training period at start, heading for full-stack development. Should be fun.
Christopher McCormack
@cmccormack
Apr 20 2018 15:26
@rajataudichya your code:
function destroyer() {
  var arr = arguments[0];
  var params = [];

  // Create array of all elements to be removed
  for (var k = 1; k < arguments.length; k++) params.push(arguments[k]);

  // return all not matching values
  return arr.filter(function(item) {
    return params.indexOf(item) < 0;
  });
}

console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3)); // Outputs [1, 1]
Jason Luboff
@JLuboff
Apr 20 2018 15:26
@Masd925 Sounds like a good time
@tundeiness For loop should be fine, but you may need two seperate ones (again...it's been a while since I've looked at it)
tundeiness
@tundeiness
Apr 20 2018 15:28
@JLuboff okay...I will consider that approach then
Rajat
@rajataudichya
Apr 20 2018 15:30
@cmccormack I am just confuse what is indexOf(item) doing? I believe it shows the index of item in the array params , what is the item showing?
Christopher McCormack
@cmccormack
Apr 20 2018 15:31
@rajataudichya indexOf is checking if the current value in the array is in the params array - if it is, the return value will be the positional index, if not, it will return -1
tundeiness
@tundeiness
Apr 20 2018 15:37
@JLuboff I used 2 for loops and I got data from just one API call
@JLuboff two API calls that is..
@JLuboff
$(document).ready(function() {
   users = ["ESL_SC2", "OgamingSC2"];

   for (let i = 0; i < users.length; i++) {
      let baseUrl = "https://wind-bow.glitch.me/twitch-api/users/";

      let tailUrl = users[i];

      let webLink = baseUrl + tailUrl;

      $.ajax({
         url: webLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.name);
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }

   for (let j = 0; j < users.length; j++) {
      let stream = "https://wind-bow.glitch.me/twitch-api/streams/";

      let tailUrl = users[j];

      let streamLink = stream + tailUrl;
      $.ajax({
         url: streamLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.stream);
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }
});
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 15:42
@rajataudichya in ES6 if you dont need the index position you can just use .includes() to check if it includes the value and in this situation returns a boolean
Josh Queen
@Kohota107
Apr 20 2018 15:44
Afternoon all
Christopher McCormack
@cmccormack
Apr 20 2018 15:46
@Kohota107 hello
@tiagocorreiaalmeida you can also use the ~ NOT operator prior to the array index of and if the value is -1 it gets changed to a 0, great for conditionals or whatever so you don't have to do a comparison
not that you need it with ES6 :)
just think it's cool
tundeiness
@tundeiness
Apr 20 2018 15:54
Any help with this API calls below?
$(document).ready(function() {
   users = ["ESL_SC2", "OgamingSC2"];

   for (let i = 0; i < users.length; i++) {
      let baseUrl = "https://wind-bow.glitch.me/twitch-api/users/";

      let tailUrl = users[i];

      let webLink = baseUrl + tailUrl;

      $.ajax({
         url: webLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.name);
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }

   for (let j = 0; j < users.length; j++) {
      let stream = "https://wind-bow.glitch.me/twitch-api/streams/";

      let tailUrl = users[j];

      let streamLink = stream + tailUrl;
      $.ajax({
         url: streamLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.stream);
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }
});
Christopher McCormack
@cmccormack
Apr 20 2018 15:57
@tundeiness what's the issue?
tundeiness
@tundeiness
Apr 20 2018 15:58
@cmccormack I want result from the users end and the stream end at the same time
Christopher McCormack
@cmccormack
Apr 20 2018 15:58
@tundeiness you can nest your API calls and only work with the response from both from within the success function of the inner call
tundeiness
@tundeiness
Apr 20 2018 15:59
@cmccormack since I can't get stream status from users then I need to use the "streams" part but the result I hoped for is not what I'm getting.
@cmccormack so 2 API calls in one for loop?
@cmccormack instead of 2 for loops?
Christopher McCormack
@cmccormack
Apr 20 2018 16:01
@tundeiness yes
@tundeiness or you can look into promises as well if you are interested
Similar concept, just moving code around to look cleaner really
tundeiness
@tundeiness
Apr 20 2018 16:05
@cmccormack okay, will defo check out promises
Christopher McCormack
@cmccormack
Apr 20 2018 16:06
@tundeiness great good luck!
tundeiness
@tundeiness
Apr 20 2018 16:06
@cmccormack thanks
CamperBot
@camperbot
Apr 20 2018 16:06
tundeiness sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1420 | @cmccormack |http://www.freecodecamp.org/cmccormack
Jason Luboff
@JLuboff
Apr 20 2018 16:07
@tundeiness Sorry, had to step away, but looks like good guy @cmccormack took care of you
Christopher McCormack
@cmccormack
Apr 20 2018 16:07
@JLuboff I thought you were a computer program that lived in here
tundeiness
@tundeiness
Apr 20 2018 16:09
@JLuboff yup he did :)
Jason Luboff
@JLuboff
Apr 20 2018 16:09
@cmccormack That'd be neat... it'd be like the one movie...Tron!
Rajat
@rajataudichya
Apr 20 2018 16:09
@cmccormack ty
CamperBot
@camperbot
Apr 20 2018 16:09
rajataudichya sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1421 | @cmccormack |http://www.freecodecamp.org/cmccormack
tundeiness
@tundeiness
Apr 20 2018 16:12
@JLuboff like this but still getting too much
$(document).ready(function() {
   users = ["ESL_SC2", "OgamingSC2"];

   for (let i = 0; i < users.length; i++) {
      let baseUrl = "https://wind-bow.glitch.me/twitch-api/users/";

      let tailUrl = users[i];

      let webLink = baseUrl + tailUrl;
      let stream = "https://wind-bow.glitch.me/twitch-api/streams/";

        let streamLink = stream + tailUrl;

      $.ajax({
         url: webLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.name);
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });

       $.ajax({
         url: streamLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.stream);
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }

});
Jason Luboff
@JLuboff
Apr 20 2018 16:13
@tundeiness Try putting the second api call within the success of the first one
(I'm asumming you're still having trouble with the above code)
tundeiness
@tundeiness
Apr 20 2018 16:16
@JLuboff yes i am, but I will do as you have said...you know i was thinking how could one nest an API call inside another?
Jason Luboff
@JLuboff
Apr 20 2018 16:17
Just nest the second call inside the first ones success function (make sure to use a different parameter name in each success call)
tundeiness
@tundeiness
Apr 20 2018 16:18
@JLuboff
$(document).ready(function() {
   users = ["ESL_SC2", "OgamingSC2"];

   for (let i = 0; i < users.length; i++) {
      let baseUrl = "https://wind-bow.glitch.me/twitch-api/users/";

      let tailUrl = users[i];

      let webLink = baseUrl + tailUrl;
      let stream = "https://wind-bow.glitch.me/twitch-api/streams/";

      let streamLink = stream + tailUrl;

      $.ajax({
         url: webLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.name);

            $.ajax({
               url: streamLink,
               type: "GET",
               dataType: "json",
               success: function(data) {
                  console.log(data.stream);
               },
               error: function() {
                  alert("Something went wrong with the server...");
               }
            });
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }
});
Jason Luboff
@JLuboff
Apr 20 2018 16:18
I wouldn't use data as the parameter name for both, I would recomend changing one of those
tundeiness
@tundeiness
Apr 20 2018 16:20
@JLuboff yeah I did ...but it is still the same result
Christopher McCormack
@cmccormack
Apr 20 2018 16:20
Yeah - try to be more descriptive with your response parameter names because nesting asynch calls is more common than you may think
tundeiness
@tundeiness
Apr 20 2018 16:20
@JLuboff
$(document).ready(function() {
   users = ["ESL_SC2", "OgamingSC2"];

   for (let i = 0; i < users.length; i++) {
      let baseUrl = "https://wind-bow.glitch.me/twitch-api/users/";

      let tailUrl = users[i];

      let webLink = baseUrl + tailUrl;
      let stream = "https://wind-bow.glitch.me/twitch-api/streams/";

      let streamLink = stream + tailUrl;

      $.ajax({
         url: webLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data.name);

            $.ajax({
               url: streamLink,
               type: "GET",
               dataType: "json",
               success: function(result) {
                  console.log(result.stream);
               },
               error: function() {
                  alert("Something went wrong with the server...");
               }
            });
         },
         error: function() {
            alert("Something went wrong with the server...");
         }
      });
   }
});
Jason Luboff
@JLuboff
Apr 20 2018 16:21
What is the result you're getting?
tundeiness
@tundeiness
Apr 20 2018 16:21
@cmccormack okay
Christopher McCormack
@cmccormack
Apr 20 2018 16:21
@tundeiness gotta tell us what isn't working, we aren't running your code :)
tundeiness
@tundeiness
Apr 20 2018 16:22
@JLuboff the full result...as if I used for example data alone without data.name
@cmccormack sure :)
Jason Luboff
@JLuboff
Apr 20 2018 16:23
@cmccormack Hey...what antivirus do you run at work (I know you're using a macbook so may not have anything but I imagine your Window's machines do)?
Christopher McCormack
@cmccormack
Apr 20 2018 16:23
@JLuboff hmm I think McAfee but don't remember
Jason Luboff
@JLuboff
Apr 20 2018 16:23
@tundeiness Can you show an example response?
tundeiness
@tundeiness
Apr 20 2018 16:23
@JLuboff
"esl_sc2"
"ogamingsc2"

Object {
  _id: 28397211904,
  _links: Object {
    self: "https://api.twitch.tv/kraken/streams/esl_sc2"
  },
  average_fps: 60,
  channel: Object {
    _id: 30220059,
    _links: Object {},
    background: null,
    banner: null,
    broadcaster_language: "en",
    created_at: "2012-05-02T09:59:20Z",
    delay: null,
    display_name: "ESL_SC2",
    followers: 229137,
    game: "StarCraft II",
    language: "de",
    logo: "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_image-d6db9488cec97125-300x300.jpeg",
    mature: false,
    name: "esl_sc2",
    partner: true,
    profile_banner: "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_banner-f8295b33d1846e75-480.jpeg",
    profile_banner_background_color: "#050506",
    status: "RERUN: ByuN vs. herO [TvP] - Group A - IEM Katowice 2017",
    updated_at: "2018-04-20T15:30:12Z",
    url: "https://www.twitch.tv/esl_sc2",
    video_banner: "https://static-cdn.jtvnw.net/jtv_user_pictures/e45cc5e329eb5d52-channel_offline_image-1920x1080.jpeg",
    views: 74612098
  },
  created_at: "2018-04-20T02:11:51Z",
  delay: 0,
  game: "StarCraft II",
  is_playlist: false,
  preview: Object {
    large: "https://static-cdn.jtvnw.net/previews-ttv/live_user_esl_sc2-640x360.jpg",
    medium: "https://static-cdn.jtvnw.net/previews-ttv/live_user_esl_sc2-320x180.jpg",
    small: "https://static-cdn.jtvnw.net/previews-ttv/live_user_esl_sc2-80x45.jpg",
    template: "https://static-cdn.jtvnw.net/previews-ttv/live_user_esl_sc2-{width}x{height}.jpg"
  },
  stream_type: "live",
  video_height: 1080,
  viewers: 279
}

​
Object {
  _id: 28394208768,
  _links: Object {
    self: "https://api.twitch.tv/kraken/streams/ogamingsc2"
  },
  average_fps: 60,
  channel: Object {
    _id: 71852806,
    _links: Object {},
    background: null,
    banner: null,
    broadcaster_language: "fr",
    created_at: "2014-09-24T15:06:58Z",
    delay: null,
    display_name: "OgamingSC2",
    followers: 71869,
    game: "StarCraft II",
    language: "fr",
    logo: "https://static-cdn.jtvnw.net/jtv_user_pictures/ogamingsc2-profile_image-9021dccf9399929e-300x300.jpeg",
    mature: false,
    name: "ogamingsc2",
    partner: true,
    profile_banner: "https://static-cdn.jtvnw.net/jtv_user_pictures/ogamingsc2-profile_banner-d418aed2c0ef7d35-480.jpeg",
    profile_banner_background_color: "",
    status: "GSL 2018 S2 - RO32 - Groupe A",
    updated_at: "2018-04-20T15:36:14Z",
    url: "https://www.twitch.tv/ogamingsc2",
    video_banner: "https://static-cdn.jtvnw.net/jtv_user_pictures/ogamingsc2-channel_offline_image-1570cf4930177aa3-1920x1080.jpeg",
    views: 35337505
  },
  created_at: "2018-04-19T21:37:09Z",
  delay: 0,
  game: "StarCraft II",
  is_playlist: false,
  preview: Object {
    large: "https://static-cdn.jtvnw.net/previews-ttv/live_user_ogamingsc2-640x360.jpg",
    medium: "https://static-cdn.jtvnw.net/previews-ttv/live_user_ogamingsc2-320x180.jpg",
    small: "https://static-cdn.jtvnw.net/previews-ttv/live_user_ogamingsc2-80x45.jpg",
    template: "https://static-cdn.jtvnw.net/previews-ttv/live_user_ogamingsc2-{width}x{height}.jpg"
  },
  stream_type: "live",
  video_height: 1080,
  viewers: 332
}

Console
Assets
Jason Luboff
@JLuboff
Apr 20 2018 16:23
@cmccormack Oh...ew.. lol
Christopher McCormack
@cmccormack
Apr 20 2018 16:23
They have a deeply layered approach
tundeiness
@tundeiness
Apr 20 2018 16:24
@JLuboff that's what i'm getting
Christopher McCormack
@cmccormack
Apr 20 2018 16:25
@tundeiness that's exactly what you logged
no issues there
https://wind-bow.glitch.me/twitch-api/streams/OgamingSC2
go there in your browser - stream is an object
tundeiness
@tundeiness
Apr 20 2018 16:26
@cmccormack wooooow!...I wanted to see if OgamingSC2 is streaming or not
Stephen James
@sjames1958gm
Apr 20 2018 16:26
@tundeiness What's missing? If you use data and not data.name you get
bio:"For standings, schedule, and results, visit http://www.intelextrememasters.com/"
created_at:"2012-05-02T09:59:20Z"
display_name:"ESL_SC2"
logo:"https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_image-d6db9488cec97125-300x300.jpeg"
name:"esl_sc2"
type:"user"
updated_at:"2018-04-20T16:05:55Z"
_id:30220059
_links:{self: "https://api.twitch.tv/kraken/users/esl_sc2"}
tundeiness
@tundeiness
Apr 20 2018 16:26
@sjames1958gm I used data.name
Stephen James
@sjames1958gm
Apr 20 2018 16:27
@tundeiness for the stream object stream == null then you know they aren't streaming
Jason Luboff
@JLuboff
Apr 20 2018 16:28
It looks like name is within channel
Christopher McCormack
@cmccormack
Apr 20 2018 16:28
@sjames1958gm @tundeiness yup you can see this yourself in the browser here
Stephen James
@sjames1958gm
Apr 20 2018 16:28
If you look at data and not data.stream - this is one that is offline (user silgarth)
{stream: null, _links: {…}}
tundeiness
@tundeiness
Apr 20 2018 16:29
@sjames1958gm yeah..it's all coming back...I was thinking for example data.stream should show null right?
Stephen James
@sjames1958gm
Apr 20 2018 16:29
@tundeiness Yes data.stream == null
tundeiness
@tundeiness
Apr 20 2018 16:29
@cmccormack yeah I did ...
Stephen James
@sjames1958gm
Apr 20 2018 16:29
Use silgarth as the user for an off-line user
tundeiness
@tundeiness
Apr 20 2018 16:30
@sjames1958gm okay
Christopher McCormack
@cmccormack
Apr 20 2018 16:31
@tundeiness I mean... they are both currently streaming so you need to add a user that isn't
expand your test cases :)
tundeiness
@tundeiness
Apr 20 2018 16:32
@sjames1958gm @cmccormack @JLuboff apparently they are both streaming
Christopher McCormack
@cmccormack
Apr 20 2018 16:32
FreeCodeCamp doesn't stream often, might be a good test
Stephen James
@sjames1958gm
Apr 20 2018 16:32
@tundeiness Yes.
tundeiness
@tundeiness
Apr 20 2018 16:32
@sjames1958gm No wonder..
@cmccormack true, my test cases were streaming
Christopher McCormack
@cmccormack
Apr 20 2018 16:33
I wonder why that API doesn't have a streaming boolean for the users...
could probably save them a bit of bandwidth from codecamp testers :)
tundeiness
@tundeiness
Apr 20 2018 16:34
@JLuboff name is also in users too
@cmccormack you know!!!
Christopher McCormack
@cmccormack
Apr 20 2018 16:35
@tundeiness you're in good company I think every question you asked we all asked at one point too - except maybe @sjames1958gm :D
Stephen James
@sjames1958gm
Apr 20 2018 16:36
:blush:
Jason Luboff
@JLuboff
Apr 20 2018 16:37
@sjames1958gm Is our savior :smile:
tundeiness
@tundeiness
Apr 20 2018 16:37
@cmccormack one thing i'm still confused about is why the full result when what i asked for was data.name and data.stream?
Christopher McCormack
@cmccormack
Apr 20 2018 16:37
you were only getting the name for data.name
but data.stream is a large object, not the full result
it is nested within data
tundeiness
@tundeiness
Apr 20 2018 16:38
@cmccormack so how should I have called it?
Christopher McCormack
@cmccormack
Apr 20 2018 16:38
if you look closely at the full response object you'll see another property called _links as well
tundeiness
@tundeiness
Apr 20 2018 16:38
@cmccormack and he's a chelsea FC fan as well
@cmccormack okay
Christopher McCormack
@cmccormack
Apr 20 2018 16:38
@tundeiness what do you mean? that's how I would call it
:)
tundeiness
@tundeiness
Apr 20 2018 16:39
@cmccormack looool i mean how will I access the stream: null part without a condition test or something
Christopher McCormack
@cmccormack
Apr 20 2018 16:40
@tundeiness if stream is null, your condition will evaluate to false
if it's the object, which you see with the two you're testing, it will be true
null is a falsey value remember?
tundeiness
@tundeiness
Apr 20 2018 16:42
@cmccormack yeah I do

@cmccormack what I was thinking of was

{"stream":null,"_links":{"self":"https://api.twitch.tv/kraken/streams/zappis","channel":"https://api.twitch.tv/kraken/channels/zappis"}}

assuming I have the Above I thought I could just do data.stream without testing conditions. But I now understand I have to do that specifically.

Jason Luboff
@JLuboff
Apr 20 2018 16:47
I :heart: USB 3.0... Clones a 60GB HD in less than 7 minutes
Christopher McCormack
@cmccormack
Apr 20 2018 16:48
@tundeiness might as well test stream right away, you can return much earlier that way
Do whatever work you need with the users response, check for stream, if null, return
@JLuboff a USB3.0 hard drive that's only 60GB?
tundeiness
@tundeiness
Apr 20 2018 16:49
@cmccormack okay..I will do that
Jason Luboff
@JLuboff
Apr 20 2018 16:50
@cmccormack No, it cloned that amount of data in that time
Christopher McCormack
@cmccormack
Apr 20 2018 16:50
oh ok haha
Jason Luboff
@JLuboff
Apr 20 2018 16:50
Just shy of 10 GB a minute
Rajat
@rajataudichya
Apr 20 2018 16:58

function getIndexToIns(arr, num) {
  // Find my place in this sorted array.

   var fArr=[];

  fArr.push(arr);
  fArr[0].push(num);

  var gold = fArr[0].sort(function(b,a){

    return b - a;
  });


  return gold.indexOf();








}

getIndexToIns([40, 60], 50);
Since arr.push(num) was returning me 3 I had to do it the long way
\
can someone tell me why arr.push(num) was returning 3? and not [40,60,50]?
Christopher McCormack
@cmccormack
Apr 20 2018 17:00
@rajataudichya push mutates the array but returns the length
don't work with the return value, just work with arr
Rajat
@rajataudichya
Apr 20 2018 17:00
ok it....
Christopher McCormack
@cmccormack
Apr 20 2018 17:00

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push

Return value
The new length property of the object upon which the method was called.

notice how you didn't use the return value for fArr
Rajat
@rajataudichya
Apr 20 2018 17:01
I keep returning every statement so that I know if my output is as expected
Christopher McCormack
@cmccormack
Apr 20 2018 17:02
@rajataudichya you can add console.log statements within your function to get an idea of what the current value is
I do that constantly until I'm happy with how a function is working, then remove it
Rajat
@rajataudichya
Apr 20 2018 17:04
Yes I got it... i believe I am coding too much as there were very silly mistake involved from entering a > sign to forgeting what push deos... :P
Christopher McCormack
@cmccormack
Apr 20 2018 17:08
Yup we have to make mistakes to learn how not to make mistakes
at least, not as often :D
Jason Luboff
@JLuboff
Apr 20 2018 17:37
I hate computers.
Christopher McCormack
@cmccormack
Apr 20 2018 17:37
no you don't :p
Jason Luboff
@JLuboff
Apr 20 2018 17:37
Yes..Yes I do.
I've been struggling to get sysprep to run on this computer. Rebuilt it. The damn thing thinks bitlocker is on when...its not..
but it's "decrypting" right now after running manage-bde -off C:
Disk management showed it was on on the drive...but in Control panel..showed it was off.. in Windows Explorer..showed it was off..
Christopher McCormack
@cmccormack
Apr 20 2018 17:42
yeah I could see why you hate Windows
Jason Luboff
@JLuboff
Apr 20 2018 17:43
Yup. Never had issues on Win7 with sysprep...haven't had a successful sysprep with Win10 :'(
Nate Mallison
@NJM8
Apr 20 2018 17:48
You hate hardware
everyone hates hardware, haha
Jason Luboff
@JLuboff
Apr 20 2018 17:49
Hardware is easy
Nate Mallison
@NJM8
Apr 20 2018 17:49
I'm about to inherit an old tower and monitor from my wife's work place, no idea what is on it
Jason Luboff
@JLuboff
Apr 20 2018 17:49
Hopefully nothing if their IT department is doing their job
Nate Mallison
@NJM8
Apr 20 2018 17:49
I'm gonna use it to farm iron in minecraft. :sparkles: :smile:
nah I have no idea what to do with it. I think I will try to install Ubuntu or something on it to try doing some web dev stuff on that platform. I'll need a new computer someday and not keen to drop $3000 on a MBP
Jason Luboff
@JLuboff
Apr 20 2018 17:52
No need for a MBP for web dev anyways :D Not that it wouldn't be nice..but..really...unless you're doing compiling I don't see why you need anything all that powerful for web dev (or you're hosting your sites..then ya..)
Christopher McCormack
@cmccormack
Apr 20 2018 17:54
I want one of those Huawei Mate X laptops if Mac decides to go IOS on their laptops
but hardware is important man, if you have good software on shitty hardware it's still a lesser experience
Jason Luboff
@JLuboff
Apr 20 2018 17:57
I'm not saying get some shitty i3 lol
but you also don't really need an i7 with the latest graphics card
Gulsvi
@gulsvi
Apr 20 2018 17:58
I don't know...that i7 and a fancy graphics card could let me farm a lot of iron in minecraft - at 4k resolution too
Nate Mallison
@NJM8
Apr 20 2018 17:59
lol
$10,000 gaming computer to play minecraft
Gulsvi
@gulsvi
Apr 20 2018 17:59
I haven't seen an iron golem in years lol
Nate Mallison
@NJM8
Apr 20 2018 18:00
I've been playing again with my son, he likes building things and has a good imagination
@JLuboff I know you don't need a MBP for webdev, but I've had my current machine for 8 years, I have a hard time imagining not using a mac
I used a dell latitude thing at my old job. What a POS
@cmccormack Mate X looks sweet
Christopher McCormack
@cmccormack
Apr 20 2018 18:01
blatent rip off of mac but who cares
Nate Mallison
@NJM8
Apr 20 2018 18:02
Thinkpad T470 and X1 carbon look great too
but I'd have to use Linux I think, I can't stand windoze
Christopher McCormack
@cmccormack
Apr 20 2018 18:02
Mint is nice too
Nate Mallison
@NJM8
Apr 20 2018 18:02
Mint?
Christopher McCormack
@cmccormack
Apr 20 2018 18:03
Another Debian based Linux
Brad
@bradtaniguchi
Apr 20 2018 18:06
Ive been using elementry OS (looks kinda like mac) on my laptop for kicks
I never liked mint, not sure why
Nate Mallison
@NJM8
Apr 20 2018 18:06
oh ok, I'll check them out
Jason Luboff
@JLuboff
Apr 20 2018 18:07
I personally can't stand linux.. I'm good with OSX (and a little bit in OS 9) and Windows
Linux just feels like a struggle for everything lol
Christopher McCormack
@cmccormack
Apr 20 2018 18:08
a bit, but you get used to the struggle
and Debian has tons of good search results these days due to Ubuntu and Raspberry Pi
Mac has a BSD variant underneath, that was my main reason of getting one, can transllate a lot of Linux knoweldge to mac
Brad
@bradtaniguchi
Apr 20 2018 18:10
@JLuboff gasp
Christopher McCormack
@cmccormack
Apr 20 2018 18:11
@JLuboff I actually feel that way more now with Windows than Mac OS or Linux - windows has really weird configurations, registry, etc...
Jason Luboff
@JLuboff
Apr 20 2018 18:13
If I had the option.. I'd probably still use OSX... I was very comfortable with it before. Did a lot of terminal stuff (which is all similar to linux stuff obiviousily). I just haven't used a Mac in 4 years lol
Christopher McCormack
@cmccormack
Apr 20 2018 18:17
Crossing fingers they don't actually move to iOS on Macbooks
Jason Luboff
@JLuboff
Apr 20 2018 18:17
That would be the worst decision Tim Cook would ever make
Brad
@bradtaniguchi
Apr 20 2018 18:21
I was so close to buying a Mac, but then they removed the escape key, increased the price, and offered no perfomance. I bought a chromebook instead :P
Nate Mallison
@NJM8
Apr 20 2018 18:23
they removed the esc key? damn, that's malicious
Christopher McCormack
@cmccormack
Apr 20 2018 18:28
@bradtaniguchi yeah the latest are kind of shitty, I have one for work and I really don't like the feel of the keyboard and the touchbar
I love my 2015 MBP though, and would probably buy another one if this one craps out
May Kittens Devour Your Soul
@diomed
Apr 20 2018 18:57
they removed ESC key and now people can't escape from Apple
Christopher McCormack
@cmccormack
Apr 20 2018 19:10
Badum-Tiss!
Jason Luboff
@JLuboff
Apr 20 2018 19:38
Holy hell! Finally got sysprep to work on this computer...
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:40
@cmccormack didnt knew about that one :D
Jason Luboff
@JLuboff
Apr 20 2018 19:44
@tiagocorreiaalmeida I'm stuck on one of the SQL challenges on codefights
securityBreach
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:46
what's the group?
Jason Luboff
@JLuboff
Apr 20 2018 19:46
3rd group, 3rd challenge
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:47
impossible to do without regex
Jason Luboff
@JLuboff
Apr 20 2018 19:47
Really? Hmmm
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:48
I think so, also the instructions suck, there's a comment that explains more than the exercise it self xd
Jason Luboff
@JLuboff
Apr 20 2018 19:48

I was trying something like this

    Select first_name, second_name, attribute
    From users
    Where attribute like concat('_%\%', first_name, '\_',second_name,'\%%');

But obiviousily not working rihgt lol

Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:48
"I think the format should be reported as [at least 1 character] [percent sign] [first_name] [underscore] [last_name] [percent sign] [any number of characters]. At least that's what it seems like from the test / solutions I've seen."
Jason Luboff
@JLuboff
Apr 20 2018 19:49
I hadn't even thought to look at the comments
Ya I had figured that out hence my solution above but doesnt work
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:50
@cmccormack is today the day we codefight?:D
Jason Luboff
@JLuboff
Apr 20 2018 19:51
@tiagocorreiaalmeida I'll try regex, thanks btw
CamperBot
@camperbot
Apr 20 2018 19:51
jluboff sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 520 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:52
I hvaen't done that one either so I dont know :\
Jason Luboff
@JLuboff
Apr 20 2018 19:52
haha, skipped it?
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:53
oh hey that's me :D
I come back later for the mahah
them*
Thomas Tylek
@zippkidd
Apr 20 2018 19:53
Does anyone have experience with the fetch API?
Jason Luboff
@JLuboff
Apr 20 2018 19:53
I know @cmccormack uses it
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 19:54
I normally use axios but I can try to help @zippkidd
Thomas Tylek
@zippkidd
Apr 20 2018 19:54
I'm trying to use fetch in lieu of jQuery's $.getJSON() or $.ajax()
Stephen James
@sjames1958gm
Apr 20 2018 19:54
@zippkidd yes, I use fetch
Thomas Tylek
@zippkidd
Apr 20 2018 19:55
with those jQuery methods, i get a nice JSON that I can work with
I try to do: fetch(url)
.then(response => response.json())
.then(response => callback(response));
but I get a syntax error with JSON.parse
I tried response.text() and I get a weird string that kind of looks JSON
starting with: /**/ typeof === 'function' && ({...});
Stephen James
@sjames1958gm
Apr 20 2018 19:57
@zippkidd That looks like jsonp not json
Thomas Tylek
@zippkidd
Apr 20 2018 19:58
ah ok.. and I guess fetch can't work with jsonp?
Stephen James
@sjames1958gm
Apr 20 2018 19:59
I don't believe so
Thomas Tylek
@zippkidd
Apr 20 2018 19:59
:( I guess I can't use the fancy new fetch API then..
Jason Luboff
@JLuboff
Apr 20 2018 19:59
You maybe able to get regular json
Christopher McCormack
@cmccormack
Apr 20 2018 20:00
sorry was away - why use jsonp?
Stephen James
@sjames1958gm
Apr 20 2018 20:00
Yeah, jsonp actually bypasses the whole API request process
Thomas Tylek
@zippkidd
Apr 20 2018 20:00
How would I request json?
Jason Luboff
@JLuboff
Apr 20 2018 20:00
does the url have callback=? at the end?
Christopher McCormack
@cmccormack
Apr 20 2018 20:00
what api?
Thomas Tylek
@zippkidd
Apr 20 2018 20:01
Yes, do I remove that?
Jason Luboff
@JLuboff
Apr 20 2018 20:01
Try it
Thomas Tylek
@zippkidd
Apr 20 2018 20:01
this is all in regards to the TwitchTV API challenge
Christopher McCormack
@cmccormack
Apr 20 2018 20:01
Are you using the wind-bow api?
it should support json by default
you don't have to do anything special
Thomas Tylek
@zippkidd
Apr 20 2018 20:02
yesss that does it!
Christopher McCormack
@cmccormack
Apr 20 2018 20:02
jsonp is often used to get around the cross origin issue
Jason Luboff
@JLuboff
Apr 20 2018 20:02
:+1:
Thomas Tylek
@zippkidd
Apr 20 2018 20:02
Thanks for all the help @JLuboff , @sjames1958gm , and @cmccormack
CamperBot
@camperbot
Apr 20 2018 20:02
zippkidd sends brownie points to @jluboff and @sjames1958gm and @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 2406 | @jluboff |http://www.freecodecamp.org/jluboff
:star2: 1422 | @cmccormack |http://www.freecodecamp.org/cmccormack
:star2: 9219 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Christopher McCormack
@cmccormack
Apr 20 2018 20:03
I would recommend finding an API that supports cross origin requests somehow over using jsonp
Thomas Tylek
@zippkidd
Apr 20 2018 20:04
@cmccormack , I have no issues with TwitchTV's API in regards to cross origin requests. I think that was more of an issue with Wikipedia's API
Christopher McCormack
@cmccormack
Apr 20 2018 20:05
Wikipedia also has a workaround, putting the query paramter &origin=*, it's on their cors page
the server determines if they'll allow it
Thomas Tylek
@zippkidd
Apr 20 2018 20:05
Ah! Good to know! Perhaps I'll go back and try to redo that challenge with fetch then
Christopher McCormack
@cmccormack
Apr 20 2018 20:07
nah
move on, use it later :)
Thomas Tylek
@zippkidd
Apr 20 2018 20:10
Thanks again everyone, I'm hopping off for now.
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 20:10
@tiagocorreiaalmeida few changes like what?
@tiagocorreiaalmeida chanhes?
Stephen James
@sjames1958gm
Apr 20 2018 20:28
@RoniqueRicketts :wave:
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 20:28
whats up
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 20:31
@RoniqueRicketts I tought something happened to you, already messaged you with the solution 2 days ago :D
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 20:33
@tiagocorreiaalmeida Ya I was really sick bruv. I am back now. Thanks for the help man. I appreciate it
CamperBot
@camperbot
Apr 20 2018 20:33
roniquericketts sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 521 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 20:34
I am checking it out rihght now
Ken Haduch
@khaduch
Apr 20 2018 21:10
@rajataudichya :point_up: April 20, 2018 10:16 AM - the idea was that it would help you to understand what was going on with that challenge, as a learning / debugging exercise.
Did you finally solve that challenge or still working on it? (Might be done by now - i was away for a while!)
Tiago Correia
@tiagocorreiaalmeida
Apr 20 2018 21:17
@RoniqueRicketts no worries anytime
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 21:17
@tiagocorreiaalmeida ya man
I am trying to set it up properly
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 21:52
Anyone has any internship offering? :)
Brad
@bradtaniguchi
Apr 20 2018 21:54
@RoniqueRicketts You want me to offer you an internship? Or if I was offered one haha?
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 21:56
@bradtaniguchi web dev internship. I want to learn and contribute. :)
Brad
@bradtaniguchi
Apr 20 2018 21:57
I mean I have my own projects I slowly grind thru, throw you into all the complicated stuff I'm working on XD
Christopher McCormack
@cmccormack
Apr 20 2018 21:57
@RoniqueRicketts I know USAA is hiring like 3000 engineers- probably a few intern slots in there
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 21:59
@bradtaniguchi as long as you can help me get better at coding hehehe
@cmccormack send me a link heehhe
Christopher McCormack
@cmccormack
Apr 20 2018 21:59
They advertise at the ReactJS meetups in Phoenix, I'll have to see if I can find who the hiring guy is
Brad
@bradtaniguchi
Apr 20 2018 22:05
@RoniqueRicketts I've been working on pretty interesting things lately, that go beyond the usual web-page of the week sorta stuff.
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 22:12
@bradtaniguchi oh in javascript
Brad
@bradtaniguchi
Apr 20 2018 22:12
Yea I mainly focus on Javascript, not web-design. (I have no eye for such things)
More specifically, I focus more on the entire architecture and software, just not now things look, if you know what I mean
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 22:16
@bradtaniguchi sounds like the type of person to teach me hehehe
Brad
@bradtaniguchi
Apr 20 2018 22:18
I can PM you if you want, to tell you about what I'm working on right now, I'm always open for others to help, or at least get an idea of what you could do that's out there.
Ronique Ricketts
@RoniqueRicketts
Apr 20 2018 22:19
@bradtaniguchi sure I don't mind I just want to get better
Jason Luboff
@JLuboff
Apr 20 2018 23:42
@tiagocorreiaalmeida Btw... my code worked after I added Binary after like in my query. Apparently Binary makes it case sensitive. So no regex needed ;)