These are chat archives for FreeCodeCamp/Help

16th
Aug 2017
Gersho
@Gersho
Aug 16 2017 00:01
a shape in it ?
well i tried putting some borders around it, they should get it if it stands out
Aita Kane
@aita-kane
Aug 16 2017 00:09
@Gersho i didn't pay attention of it .... just write it
Gersho
@Gersho
Aug 16 2017 00:11
btw, as you can see on my project, i'm pretty bad with colors, is there some easy way to pick 2-3 colors that won't make people want to pluck their eyes out ?
Luke Al-Saba
@LukeAlSaba
Aug 16 2017 00:15
Hi, is anyone here from the FCC team?
Ravi Kishore Thella
@ravikishorethella
Aug 16 2017 00:15
what do you mean by FCC team? @LukieID
Luke Al-Saba
@LukeAlSaba
Aug 16 2017 00:16
@ravikishorethella a member of the official fcc team
Ravi Kishore Thella
@ravikishorethella
Aug 16 2017 00:17
I am not the one :smile:
Aita Kane
@aita-kane
Aug 16 2017 00:17
@Gersho the color of the sky
check here for the color https://uigradients.com/#Mauve
Gersho
@Gersho
Aug 16 2017 00:20
@aita-kane well since i don't know all the possible api answer, i can't really make it variable, but i'll pick some blue i guess
Margaret
@Margaret2
Aug 16 2017 00:25
@LukieID Didn't you just ask that last night? and @thekholm80 gave you this answer
:point_up: August 14, 2017 7:12 PM
Mike Batista
@mbmontana
Aug 16 2017 00:35

Profile Lookup challenge in Javascript

Instructions: The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

I finally got the code to the point where there are no error messages, but I'm still not quite there. Am I close?


//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
for (i = 0; i < contacts.length; i++)   
{if (firstName==contacts[i].firstName) {
    if (contacts[i].hasOwnProperty(prop)) {return contact[i].prop;} }
        else if (firstName!==contacts[i].firstName) {return "No such property";} 
 else {return "No such contact";}}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Long Nguyen
@longnt80
Aug 16 2017 00:38
@aita-kane are you still there?
@aita-kane add this box-sizing: border-box; to * in your css
@mbmontana you need to return outside the loop
Mike Batista
@mbmontana
Aug 16 2017 00:45
@longnt80 Well there are three possible returns.
Long Nguyen
@longnt80
Aug 16 2017 00:46
@mbmontana I think you only need 2 return
"No such property" and "No such contact"
you don't need return contact[i].prop;
Mike Batista
@mbmontana
Aug 16 2017 00:47
But it says: If both are true, then return the "value" of that property.
Long Nguyen
@longnt80
Aug 16 2017 00:48
my bad, yeah you still need it
but {return "No such contact";} should be outside the loop
Gersho
@Gersho
Aug 16 2017 00:48
but if you return it's gonna stop at the first loop
Mike Batista
@mbmontana
Aug 16 2017 00:51
@longnt80 outside the For loop?
Long Nguyen
@longnt80
Aug 16 2017 00:51
@mbmontana outside the for loop
Gersho
@Gersho
Aug 16 2017 00:52
it should return only on the following condition
-you found what you were looking for
-you did all the loops, yet couldn't find
Long Nguyen
@longnt80
Aug 16 2017 00:53
@mbmontana the loop is to iterate through all the objects, so you need to check all the contacts (object) before announce that there's no such contact
Gersho
@Gersho
Aug 16 2017 00:54
if i'm on last loop: do something else
dyon3334
@dyon3334
Aug 16 2017 01:12
can someone help me it make a infinite loop on line 6 but i dont know what st the problem
function getIndexToIns(arr, num) {
    var sorted = arr.sort(compareFunction);
    var output = [];
    for (i = 0; i < sorted.length; i++) {
        if (num < arr[i]) {
            output = sorted.splice(i, 0, num);
        }
    }
    return output;
}

function compareFunction(a, b) {
    return a - b;
}
getIndexToIns([80, 60], 50);
Manish Giri
@Manish-Giri
Aug 16 2017 01:13
@dyon3334 you're iterating over an array while also mutating it
signs pointing to inf. loop
dyon3334
@dyon3334
Aug 16 2017 01:13
@Manish-Giri is this asmall fix ?
Manish Giri
@Manish-Giri
Aug 16 2017 01:14
@dyon3334 try this -
  1. push num to arr
  2. sort arr
  3. use indexOf to get index of num in arr
that's it..
3 lines
dyon3334
@dyon3334
Aug 16 2017 01:15
so this code is useless ?
function getIndexToIns(arr, num) {
    var sorted = arr.sort(compareFunction);
    var output = [];
    for (i = 0; i < arr.length; i++) {
        if (num < sorted[i]) {
            output = sorted.splice(i, 0, num);
        }
    }
    return output;
}

function compareFunction(a, b) {
    return a - b;
}
getIndexToIns([80, 60], 50);
@Manish-Giri but your solution is a lot smarter !! thanks im gonna work on it
CamperBot
@camperbot
Aug 16 2017 01:16
dyon3334 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6419 | @manish-giri |http://www.freecodecamp.com/manish-giri
Mike Batista
@mbmontana
Aug 16 2017 01:17
@longnt80 @Gersho Don't these two lines of code iterate through all the objects and then set the first if (condition) at firstName matching the firstName in any of the objects?
for (i = 0; i < contacts.length; i++)   
{if (firstName==contacts[i].firstName)
Manish Giri
@Manish-Giri
Aug 16 2017 01:17
@dyon3334 good luck
dyon3334
@dyon3334
Aug 16 2017 01:19
@Manish-Giri thanks!
CamperBot
@camperbot
Aug 16 2017 01:19
dyon3334 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: dyon3334 already gave manish-giri points
Long Nguyen
@longnt80
Aug 16 2017 01:20
@mbmontana what if firstName is Bob, like lookUpProfile("Bob", "likes");
your condition is never met
Mike Batista
@mbmontana
Aug 16 2017 01:21
@longnt80 That's why I do this later on:
for (i = 0; i < contacts.length; i++)   
{if (firstName==contacts[i].firstName) 
{if (contacts[i].hasOwnProperty(prop)) 
{return contact[i].prop;} }
        else if (firstName!==contacts[i].firstName)
@longnt80 !== means not equal to, correct?
Long Nguyen
@longnt80
Aug 16 2017 01:23
can you copy your updated code again
Mike Batista
@mbmontana
Aug 16 2017 01:23

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
for (i = 0; i < contacts.length; i++)   
{if (firstName==contacts[i].firstName) 
{if (contacts[i].hasOwnProperty(prop)) 
{return contact[i].prop;} }
        else if (firstName!==contacts[i].firstName) 
        {return "No such property";} 
 else {return "No such contact";}}




// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Joseph
@revisualize
Aug 16 2017 01:24
Hey
@mbmontana re: contact[i].prop;
Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
@mbmontana The return statement ends function execution and specifies a value to be returned to the function caller.
Syntax
return [[expression]];
expression
The expression to return. If omitted, undefined is returned instead.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return

@mbmontana

for (var i = 0; i < 1000000; i++) {
     if (i === 10) {
                return 10;
     }
     else {
                return "Not 10";
     }
}

This loop will NOT lop. Because...
And IF something isn't true.. It is false...
In this case the else statement is a return value... SOOO.. It not only halts the loop but, It halts the whole function.

Long Nguyen
@longnt80
Aug 16 2017 01:26

@mbmontana this

else if (firstName!==contacts[i].firstName) {
      return "No such property";
  }

is checking the firstName/contact so return "No such property" is not correct

Joseph
@revisualize
Aug 16 2017 01:26
@mbmontana And ---^
Long Nguyen
@longnt80
Aug 16 2017 01:27
@mbmontana this one is a tough one, take your time
Joseph
@revisualize
Aug 16 2017 01:27
@mbmontana
If you're looking for a value in an array and you do this:
var value = "e"
var arr = ["a", "b", "c", "d", "e"];
for (var i = 0; i < arr.length; i++) {
     // at the first iteration i is 0
     // arr[i] is arr[0] and arr[0] holds the value of "a"
     // if ("e" === "a") ... return "True" ... Well, "e" is not "a" so, no.
      if (value === arr[i]) { return "True"; }
     // okay so next block
     // if "e" is not equal to "a" ... that's true ... so ... return "False"
      else if (value !== arr[i]) { return "False" }
}
Mike Batista
@mbmontana
Aug 16 2017 01:28
@longnt80 @revisualize Time for dinner. Will have to get back to this later.
Long Nguyen
@longnt80
Aug 16 2017 01:28
@mbmontana bon appetit
Eric Miller
@ericmiller777
Aug 16 2017 01:36
how can i check if a json object is null?
im trying if (streams.stream == null)
but thats not working
Long Nguyen
@longnt80
Aug 16 2017 01:37
@ericmiller777 what does a null json object look like?
Gersho
@Gersho
Aug 16 2017 01:40
json.stream == null works fine in my pen
Long Nguyen
@longnt80
Aug 16 2017 01:41
@ericmiller777 try json["stream"]
Gersho
@Gersho
Aug 16 2017 01:43

the error must be elsewhere in your code because i'm using

 $.getJSON(callUrl, function(json){
      if (json.stream == null){
    //do stuff
      } else {
  //do other stuff
      };
    });

and it works

RichyMel
@richymel
Aug 16 2017 01:45
@ericmiller777 check this out... https://jsfiddle.net/richymel/jz1g93xw/
Eric Miller
@ericmiller777
Aug 16 2017 01:47
json is undefined
Gersho
@Gersho
Aug 16 2017 01:48
your error is somewhere else then
link your pen ?
Eric Miller
@ericmiller777
Aug 16 2017 01:50
just been doing this too long
lol
I think i see the issue
Gersho
@Gersho
Aug 16 2017 01:51
obviously, once you find it, it looks like soomething stupid, but that's how mistakes usualy are ^ ^
Eric Miller
@ericmiller777
Aug 16 2017 01:52
@Gersho thanks
CamperBot
@camperbot
Aug 16 2017 01:52
ericmiller777 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 323 | @gersho |http://www.freecodecamp.com/gersho
Eric Miller
@ericmiller777
Aug 16 2017 01:52
@richymel thanks
@longnt80 thanks
CamperBot
@camperbot
Aug 16 2017 01:52
ericmiller777 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 505 | @longnt80 |http://www.freecodecamp.com/longnt80
RichyMel
@richymel
Aug 16 2017 01:55
@ericmiller777 I just updated the fiddle with new insights... please check it
it goes and retrieves object properties and property values if they exist
Eric Miller
@ericmiller777
Aug 16 2017 02:03
@richymel thanks
CamperBot
@camperbot
Aug 16 2017 02:03
ericmiller777 sends brownie points to @richymel :sparkles: :thumbsup: :sparkles:
Eric Miller
@ericmiller777
Aug 16 2017 02:03
githubs being weird today
CamperBot
@camperbot
Aug 16 2017 02:03
:cookie: 305 | @richymel |http://www.freecodecamp.com/richymel
Ginger
@GingerChew
Aug 16 2017 02:05
Hey, I'm getting kind of stuck on this javascript problem. I'm pretty sure there's a better way to do it, but I keep thinking I need to use iterators and if statements. I wanted to get some second opinions though?
hold on I spoke too soon, lemme rewrite what I had

```
function convertToRoman(num) {
var number = num.toString().split('');
var numerals = number.splice(-1,1);
var output= '';
for (var i = 0; i < numerals[0];i++) {
if (numerals[0]>5){
output += 'V'
}
}

return numerals.join();
}
``` This is the jist of what I've got going on, I just feel like this is the long way around?

ugh, markdown
function convertToRoman(num) {
  var number = num.toString().split('');
  var numerals = number.splice(-1,1);
  var output= '';
  for (var i = 0; i < numerals[0];i++) {
    if (numerals[0]>5){
      output += 'V'
    } else if(and so on and soforth...) {
  }

  return numerals.join();
}
Ginger
@GingerChew
Aug 16 2017 02:12
I'm trying not to just google for the answer, but I'm not sure how else to tackle this than hardcoding each response
Eric Miller
@ericmiller777
Aug 16 2017 02:16
havnt done that one yet
korzo
@korzo
Aug 16 2017 02:17
@GingerChew You can do it much easier with while loop
Ginger
@GingerChew
Aug 16 2017 02:18
okay thanks!
@korzo thanks! (wanted to make sure you got the brownie/cookie points)
CamperBot
@camperbot
Aug 16 2017 02:18
gingerchew sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 382 | @korzo |http://www.freecodecamp.com/korzo
Eric Miller
@ericmiller777
Aug 16 2017 02:21
so i check if stream is null, if it isnt show stream info
but no matter what it just does the same as if it is null
korzo
@korzo
Aug 16 2017 02:22
@GingerChew It can be solved in 5-6 lines
Ginger
@GingerChew
Aug 16 2017 02:22
oh jeez, don't tell me that lol
C
@engineerwithoutfear
Aug 16 2017 02:32

https://glitch.com/edit/#!/spurious-city?path=server.js:1:0

Could anyone help me figure out why this keeps returning undefined?

Gersho
@Gersho
Aug 16 2017 02:36
@ericmiller777 why do you have so many API calls ? one for each channel is enougth
Eric Miller
@ericmiller777
Aug 16 2017 02:37
i have 3?
Gersho
@Gersho
Aug 16 2017 02:38
i suppose ? i haven't use the .done syntax yet
Eric Miller
@ericmiller777
Aug 16 2017 02:41
i can read from them just fine
its only that my if statement doesnt seem to be working
fdemaa
@fdemaa
Aug 16 2017 02:44
hey guys
Eric Miller
@ericmiller777
Aug 16 2017 02:46
good enough i guess
Gersho
@Gersho
Aug 16 2017 02:48

i can read from them just fine

making less calls is more about ressources, not gonna be a problem for this project but a good habit to have for bigger stuff (today my internet decided i'll get chain disconected :x )

@fdemaa doesn't really need to make the user click to get the weather, apart from that looks ok
i wonder what a broken cloud is tho
Ginger
@GingerChew
Aug 16 2017 02:50
@fdemaa Having the button 'show me the weather' is okay, but it makes more sense (from a design aspect) to just show the weather when the page loads. Also, and maybe its just personal taste, the orange of the icon feels like its clashing with the blue background.
Gersho
@Gersho
Aug 16 2017 02:52
also, i don't know if it's because i live in the middle of nowhere, but the 3 temperatures shown are the same
https://codepen.io/Gersho/pen/YQKYGo
i'd like opinions on mine too please
fdemaa
@fdemaa
Aug 16 2017 02:53

@Gersho Its a glitch i think of the api in my hometown i have the same issue, but others people told me that the max and min temperatures are working for them

We live in strange places then haha :)

@Gersho thanks man
CamperBot
@camperbot
Aug 16 2017 02:53
fdemaa sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @gersho |http://www.freecodecamp.com/gersho
Ginger
@GingerChew
Aug 16 2017 02:53
@fdemaa Also maybe rearrange the information to be more weather-centric? The top row is all information I know, second row could be just one or two items (cur: 82degrees min/max:89/76) and the third row is a lot of extra information. Also the skycon should probably be first or at the top of the page.
@fdemaa but the technical stuff is all there
fdemaa
@fdemaa
Aug 16 2017 02:54
@GingerChew thanks ginger ! i will admite i wasnt very inspired in the design of this one haha :)
I will try to make it look a bit better !
CamperBot
@camperbot
Aug 16 2017 02:54
fdemaa sends brownie points to @gingerchew :sparkles: :thumbsup: :sparkles:
:cookie: 268 | @gingerchew |http://www.freecodecamp.com/gingerchew
Ginger
@GingerChew
Aug 16 2017 02:55
@Gersho maybe it's just on my screen, but the border on the farenheit celsius button is a little tight. Maybe add some padding? Also the icon you're using is really pixelated and I'm not sure what its depicting. Very minimalist though!
Gersho
@Gersho
Aug 16 2017 02:56
it's the icons provided for the challenge, maybe i zoomed it a bit too much ^ ^ , i'll try reducing the border (it's here only so that people notice you can clic on it)
thanks @GingerChew
CamperBot
@camperbot
Aug 16 2017 02:56
gersho sends brownie points to @gingerchew :sparkles: :thumbsup: :sparkles:
:cookie: 269 | @gingerchew |http://www.freecodecamp.com/gingerchew
Ginger
@GingerChew
Aug 16 2017 02:57
@fdemaa no worries man, I'm a design geek so that was the first thing I looked at. But you've built everything else really solidly.
Gersho
@Gersho
Aug 16 2017 02:58
i go for minimalist because when i try to make it fancy it ends ugly
fdemaa
@fdemaa
Aug 16 2017 02:58
@Gersho i like it man ! i also prefer minimalist designs !
Ginger
@GingerChew
Aug 16 2017 02:59
@Gersho I feel ya, my portfolio page is in the middle of a redesign and its making my eyes bleed
fdemaa
@fdemaa
Aug 16 2017 02:59
@GingerChew haha thats cool man; do you mind check my quote generator i also finished it a few days ago ?
Gersho
@Gersho
Aug 16 2017 03:00
@GingerChew my portoflio is so ugly, it's an insult to colorblind people that i am still allowed near a color tool
@fdemaa why don't you link your pen
fdemaa
@fdemaa
Aug 16 2017 03:02
here
Gersho
@Gersho
Aug 16 2017 03:03
really cool with the pictures
@fdemaa
Eric Miller
@ericmiller777
Aug 16 2017 03:03
anyone know why my if statement isnt working?
@fdemaa very nice
fdemaa
@fdemaa
Aug 16 2017 03:04
@ericmiller777 @Gersho thanks guys!
CamperBot
@camperbot
Aug 16 2017 03:04
fdemaa sends brownie points to @ericmiller777 and @gersho :sparkles: :thumbsup: :sparkles:
:warning: fdemaa already gave gersho points
:cookie: 269 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
Gersho
@Gersho
Aug 16 2017 03:06
@ericmiller777 have you checked via console log what streams.stream.channel returns ? or streams.stream
ericmiller777.github.io/:59 Uncaught TypeError: Cannot read property 'channel' of null
so streams.stream is null, thus does not have any 'channel' property to read
Eric Miller
@ericmiller777
Aug 16 2017 03:07
testing it
oh that was just a test
check code now
i logged it
just
null
ive tryued every combination of everything
Gersho
@Gersho
Aug 16 2017 03:09
the images gets bigger when you reduce screen size
well it seem to work what's wrong
hey wait ogaming isn't offline
Eric Miller
@ericmiller777
Aug 16 2017 03:10
yea
two of them arent online
or well one mightve just went offline
but the starcraft one isnt
Gersho
@Gersho
Aug 16 2017 03:11
of course it isn't, starcraft never sleeps
i dont understand
if i code it with no if statement
it returns just fine
Gersho
@Gersho
Aug 16 2017 03:12

well like i said earlier in the day, in my own pen, i use

     $.getJSON(callUrl, function(json){
      if (json.stream == null){

and it works fine

so i can't really tell how yours wouldn't
Eric Miller
@ericmiller777
Aug 16 2017 03:13
:(
Gersho
@Gersho
Aug 16 2017 03:14
so for you it would be streams.stream , assuming i'm understanding your code propely
Eric Miller
@ericmiller777
Aug 16 2017 03:14
should be
Gersho
@Gersho
Aug 16 2017 03:14
but i don't understand what the first calls are for
Ginger
@GingerChew
Aug 16 2017 03:15
@fdemaa The pictures are a nice touch, but I would set them up to all be the same size. Having the button underneath the text move around is jarring but I think unavoidable. No sense moving it more with the pictures too. Whatever the smallest picture is should be the max height and then width can just be auto.
Gersho
@Gersho
Aug 16 2017 03:15
you don't even use the data
Ginger
@GingerChew
Aug 16 2017 03:16
@fdemaa also I noticed this with your java in the other pen, but you don't have to declare a variable for each of your dom elements. That wastes a bunch of time. If you give an element an id, you can just reference it is $('#id-title').whatIWantToDo and it should be fine.
Eric Miller
@ericmiller777
Aug 16 2017 03:16
actully if i dont use the jsonp call there i get a CORS error
Ginger
@GingerChew
Aug 16 2017 03:17
@Gersho lol I'd be lying if I wasn't constantly referring to the material design docs to try and get something even slightly tasteful put out
Gersho
@Gersho
Aug 16 2017 03:17
i mean why do you call for users and channels too ? stream gives you plenty of data already @ericmiller777
Eric Miller
@ericmiller777
Aug 16 2017 03:17
well if it is null
stream give no data
Ginger
@GingerChew
Aug 16 2017 03:18
@ericmiller777 if you're getting a cross origin error you can add callback=? to your json call to ignore that
Eric Miller
@ericmiller777
Aug 16 2017 03:18
the only one i dont need is channels
Gersho
@Gersho
Aug 16 2017 03:18
@ericmiller777 and if it's null, what kind of data would you need ? you already have channel name, and you know it's offline
Eric Miller
@ericmiller777
Aug 16 2017 03:19
no i use stream.streams to check id online or not?
Gersho
@Gersho
Aug 16 2017 03:20
yes, if it's on it gives you data of what it's streaming, and if it's null, you put something like chanName is offline or whatever
Eric Miller
@ericmiller777
Aug 16 2017 03:20
yea
do you know another way of checking if online?
Gersho
@Gersho
Aug 16 2017 03:21
i don't know, why would you need one ?
Eric Miller
@ericmiller777
Aug 16 2017 03:21
to give info abouyt the stream for channels that are online
Gersho
@Gersho
Aug 16 2017 03:22
that's already in /stream
Eric Miller
@ericmiller777
Aug 16 2017 03:22
but for ones that areant
i need it to show offline
thats why i need the if statement
fdemaa
@fdemaa
Aug 16 2017 03:23
@GingerChew thanks ginger ! yeah i know about that, thats a stupid habit i tend to do lol !
i will try to remember not doing
CamperBot
@camperbot
Aug 16 2017 03:23
fdemaa sends brownie points to @gingerchew :sparkles: :thumbsup: :sparkles:
:warning: fdemaa already gave gingerchew points
Gersho
@Gersho
Aug 16 2017 03:26
@ericmiller777 well, mine works so i don't know, but i used getJSON, and wwhen i use ajax i always use success: and don't know the .done syntax, so maybe there's something specific, try using a?b:c instead
Eric Miller
@ericmiller777
Aug 16 2017 03:26
whats that?
maybe ill just chang emine to getJson
Gersho
@Gersho
Aug 16 2017 03:28
google for Conditional (ternary) Operator for the a?b:c, it's a diffent syntax of if then else, sometimes works where if doesn't, don't ask why i have no clue
anyway good luck with that, i'm off :)
Eric Miller
@ericmiller777
Aug 16 2017 03:31
@Gersho thanks
CamperBot
@camperbot
Aug 16 2017 03:31
ericmiller777 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 325 | @gersho |http://www.freecodecamp.com/gersho
Ginger
@GingerChew
Aug 16 2017 03:39
@fdemaa :thumbsup:
so i did that
still
same problem
i dont understand
Albert Cardona II
@daddycardona
Aug 16 2017 04:28
what is the problem eric it looks like it is working to me \
@ericmiller777
Albert Cardona II
@daddycardona
Aug 16 2017 04:44
@ericmiller777 if it says Null it is because they are offline
so you can write if(data.stream===null){do something}
@baseballpoetess
are you on?
Joseph
@revisualize
Aug 16 2017 05:37
Hey.
Darren
@DarrenfJ
Aug 16 2017 05:37
evening fCC
Joseph
@revisualize
Aug 16 2017 05:38
@DarrenfJ How goes it?
Darren
@DarrenfJ
Aug 16 2017 05:39
@revisualize goodGood and you?
Joseph
@revisualize
Aug 16 2017 05:40
@DarrenfJ Meh.
@DarrenfJ I'm supposed to be doing physical therapy 5 times a day.
It hurts.
Manish Giri
@Manish-Giri
Aug 16 2017 05:42
@DarrenfJ :wave:
Darren
@DarrenfJ
Aug 16 2017 05:46
@revisualize oh yah, dang... the arm...
@Manish-Giri hey buddy
Albert Cardona II
@daddycardona
Aug 16 2017 06:32
good morning :)
Joseph
@revisualize
Aug 16 2017 06:33
@daddycardona Good Evening.
Darren
@DarrenfJ
Aug 16 2017 06:35
@daddycardona helloHello!
Albert Cardona II
@daddycardona
Aug 16 2017 06:36
whats good yall
Nahuel Ovejero
@NahuelOvejero
Aug 16 2017 06:38
manish is good
Darren
@DarrenfJ
Aug 16 2017 06:41
manish rawks
Manish Giri
@Manish-Giri
Aug 16 2017 06:42
:angel:
revising ruby is a pain
Darren
@DarrenfJ
Aug 16 2017 06:44
I'm still just in Codecademy intro mode but i'm still loving the weird way they do codeblocks and avoid return statement and all the .doSomething! 's
they really lurve their !'s
Manish Giri
@Manish-Giri
Aug 16 2017 06:46
oh yiss
like
Darren.isAwesome? # true
Albert Cardona II
@daddycardona
Aug 16 2017 06:46
thats is cool so its like this
Manish Giri
@Manish-Giri
Aug 16 2017 06:47
"darren".sort!
@DarrenfJ btw im also at codeacademy
the last OOP section
Darren
@DarrenfJ
Aug 16 2017 06:47
:D
i'm about 70% through the Ruby stuff... but only do like 1 or 2 exercises a night
Albert Cardona II
@daddycardona
Aug 16 2017 06:57
I am stuck on the roman numeral one
Darren
@DarrenfJ
Aug 16 2017 06:59
@daddycardona what's happening with it?
Emmanuel Akodia
@akodiaemma
Aug 16 2017 07:00
is it possible to download the source code of an interactive web application?
Eric Miller
@ericmiller777
Aug 16 2017 07:01
been stuck on a problem for hours anythine think they can help?
it will not print
the stream
for each thing
only the first one
Albert Cardona II
@daddycardona
Aug 16 2017 07:03
how can I see that in code?
put it in a for loop
or while loop
@ericmiller777
Manish Giri
@Manish-Giri
Aug 16 2017 07:08
@DarrenfJ check your pm
Albert Cardona II
@daddycardona
Aug 16 2017 07:09
I would also recommend that your css go to a css file or style section instead of styling them in your print or append @ericmiller777
Eric Miller
@ericmiller777
Aug 16 2017 07:12
@daddycardona for some reason they dont tend to work when i do that
Albert Cardona II
@daddycardona
Aug 16 2017 07:12
you have to give them a class too
class="aclassLOL"
Eric Miller
@ericmiller777
Aug 16 2017 07:12
lol
sure
i can do that
but
i cant figure out
why
Albert Cardona II
@daddycardona
Aug 16 2017 07:13
I am trying to decipher your code so it makes more sense to me
Eric Miller
@ericmiller777
Aug 16 2017 07:13
i see
okay
i had it much different before this
Albert Cardona II
@daddycardona
Aug 16 2017 07:13
I don't understan what you trying to see?
Darren
@DarrenfJ
Aug 16 2017 07:13
@Manish-Giri hey thanks for the info :D
CamperBot
@camperbot
Aug 16 2017 07:13
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6421 | @manish-giri |http://www.freecodecamp.com/manish-giri
Darren
@DarrenfJ
Aug 16 2017 07:13
something new to obsess about ;)
Albert Cardona II
@daddycardona
Aug 16 2017 07:14
I also see you did everything on one page instead of braking it down so I am trying to break it down @ericmiller777
Eric Miller
@ericmiller777
Aug 16 2017 07:15
understood
Albert Cardona II
@daddycardona
Aug 16 2017 07:16
so did you console log everthing or at least what you want to see?
@ericmiller777 you know that you have two failed resources?
Eric Miller
@ericmiller777
Aug 16 2017 07:19
for (var i = 0; i < usersArray.length; i++ ){
$.getJSON("https://wind-bow.glitch.me/twitch-api/users/" + usersArray[i], function (users) {
$.getJSON("https://wind-bow.glitch.me/twitch-api/streams/" + usersArray[i], function (streams) {
if (streams.stream == null){
    $("#main-group").append(`<li class="list-group-item btn btn-default" style="white-space: normal; overflow: hidden;" ><div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2"><img id = "logo" class="img-responsive" src="${users.logo}"></img></div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10"><span id="streamInfo" style="float: left"><span style="font-size: 25px;"><b>${users.display_name}</b></span><br>--offline</span></div></div><span>${users.bio}</span></li>`);
}else{
    $("#main-group").append(`<li class="list-group-item btn btn-default" style="white-space: normal; overflow: hidden;" ><div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2"><img id = "logo" class="img-responsive" src="${users.logo}"></img></div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10"><span id="streamInfo" style="float: left"><span style="font-size: 25px;"><b>${users.display_name}</b></span><br>${streams.stream.channel.status}</span></div></div><span>${users.bio}</span></li>`);
}           
});            
});
}
that was my code
@daddycardona which?
and before that i did it with ajax
Albert Cardona II
@daddycardona
Aug 16 2017 07:20
It says null on some favicon and something else
Eric Miller
@ericmiller777
Aug 16 2017 07:20
only icon i have shows up?
i cant figure out
why doesnt that code work
if i dont have the if statement it works fine btw
its like it doesnt check all of them
Albert Cardona II
@daddycardona
Aug 16 2017 07:23
Yeah but I see streamInfo${i} looks different like what does that do I did not use that in my code so does that $ dosomething special?
Eric Miller
@ericmiller777
Aug 16 2017 07:25
sorry where do you see that
that was a test im so sorry
wait a sec the code will update
where do you see that
Albert Cardona II
@daddycardona
Aug 16 2017 07:26
I saw one issues it was your <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" /> missing https:
so i could not get the favicon
js function
Eric Miller
@ericmiller777
Aug 16 2017 07:27
i think i copied that
Albert Cardona II
@daddycardona
Aug 16 2017 07:27
function users
Eric Miller
@ericmiller777
Aug 16 2017 07:28
from the website
Albert Cardona II
@daddycardona
Aug 16 2017 07:28
I done that before left out the httPs:// lol
i copied it too and missed the first ht lol
Eric Miller
@ericmiller777
Aug 16 2017 07:28
any idea why it doesnt check if the object is null?
Albert Cardona II
@daddycardona
Aug 16 2017 07:30
<span id="streamInfo${i}" style="float: left">
and no not yet
Eric Miller
@ericmiller777
Aug 16 2017 07:31
that is no longer in the code i tryed giving a tag each with a different number based on the i
Albert Cardona II
@daddycardona
Aug 16 2017 07:33
you not checking to see if its null you saying if its not null
Eric Miller
@ericmiller777
Aug 16 2017 07:33
well
Albert Cardona II
@daddycardona
Aug 16 2017 07:33
so to check if its null you want to put if streams.streams === null
Eric Miller
@ericmiller777
Aug 16 2017 07:34
read the last bit of code i linked
ive tryed many ways
scroll up a bit
that way which i prefer
does check both
Albert Cardona II
@daddycardona
Aug 16 2017 07:34
okay maybe i bypassed it I do that when I am trying to read fast lol
try the === null
I also see its commented out //
just pushed it
they just all say offline
Albert Cardona II
@daddycardona
Aug 16 2017 07:42
yeah except esl
His is not null either you also forgot to put the https:// in the front of frontawesome
Eric Miller
@ericmiller777
Aug 16 2017 07:43
for me they all say offline
added it
Albert Cardona II
@daddycardona
Aug 16 2017 07:45
now it does for me too let me check hold on
Bashir Harrell
@bookofbash
Aug 16 2017 07:46
For some reason my twitch viewer has divs that won't align. Any help?
https://bookofbash.github.io/twitchviewer/
Eric Miller
@ericmiller777
Aug 16 2017 07:47
@bookofbash thats nice
Bashir Harrell
@bookofbash
Aug 16 2017 07:48
@ericmiller777 thanks, I just don't know why I cant get them to just align properly
CamperBot
@camperbot
Aug 16 2017 07:48
bookofbash sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 270 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
Darren
@DarrenfJ
Aug 16 2017 07:49
I'm just about to start in on the viewer this week too...
Eric Miller
@ericmiller777
Aug 16 2017 07:54
@daddycardona any ideas been working on this for hours
and it seems like it should be simple
Albert Cardona II
@daddycardona
Aug 16 2017 07:54
It is simple I did mine different than yours so I am just making sense out of it lol
I am slow forgive me LOL
Eric Miller
@ericmiller777
Aug 16 2017 07:56
@daddycardona no problem thanks for looking
CamperBot
@camperbot
Aug 16 2017 07:56
ericmiller777 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Aug 16 2017 07:56
I see you have 2 fetches for the api
Eric Miller
@ericmiller777
Aug 16 2017 07:56
yes
i dont know how to call both
i have tryed seperateing them tho
Albert Cardona II
@daddycardona
Aug 16 2017 08:00
yeah you are calling the streams okay but then you are like missing out on the streams they are undefine thats why they are all null
Eric Miller
@ericmiller777
Aug 16 2017 08:03
?
Albert Cardona II
@daddycardona
Aug 16 2017 08:04
Okay so your first call to should be streams userArray[i]
then if you need information you can call a new function like this I will show you in a second let me make sure I am correct ;)
Eric Miller
@ericmiller777
Aug 16 2017 08:05
:)
Albert Cardona II
@daddycardona
Aug 16 2017 08:18
I got some of it doen :)
pretty much just fixing simple shit but you should use console log to see what is not getting your attention lol ;)
Eric Miller
@ericmiller777
Aug 16 2017 08:20
i see
Albert Cardona II
@daddycardona
Aug 16 2017 08:28
I got the stream=== null to work lol
Eric Miller
@ericmiller777
Aug 16 2017 08:28
how lol?
Eric Miller
@ericmiller777
Aug 16 2017 08:40
@daddycardona you there?
Albert Cardona II
@daddycardona
Aug 16 2017 08:40
sorry yes
your else statement
else {
                        console.log(streams)
                        $("#main-group").append(`<li class="list-group-item btn btn-default"
                 style="white-space: normal; overflow: hidden;" >
                 <div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
                <img id = "logo" class="img-responsive" src="${streams.stream.channel.logo}">
                </img></div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10">
               <span id="streamInfo" style="float: left"><span style="font-size: 25px;">
                <b>${streams.stream.channel.display_name}</b></span>
                <br>${streams.stream.channel.status}</span></div></div>
                <span>${streams.bio}</span></li>`);
                    }
                });
there is no streams .stream.channel.bio
Eric Miller
@ericmiller777
Aug 16 2017 08:42
.bio?
Where did I type that?
Weird
@daddycardona on my screen it says users.bio
im not sure why yours says steams?
stream
Albert Cardona II
@daddycardona
Aug 16 2017 08:45
I had to change that because you had users bio but I changed the function a little like this
Eric Miller
@ericmiller777
Aug 16 2017 08:46
yea thatw ould work
but the problem is that
if streams is null then i would have npothing
Albert Cardona II
@daddycardona
Aug 16 2017 08:46
$(function() {

        var usersArray = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "habathcx", "RobotCaleb", "noobs2ninjas", "vgbootcamp"];
        var users;
        for (var i = 0; i < usersArray.length; i++) {

            $.getJSON("https://wind-bow.glitch.me/twitch-api/streams/" + usersArray[i], function(streams) {
                if (streams.stream === null) {

                    $.getJSON("https://wind-bow.glitch.me/twitch-api/users/" + usersArray[i], function(info) {
                        console.log(info);
                        $("#main-group").append(`<li class="list-group-item btn btn-default"
                             style="white-space: normal; overflow: hidden;" >
                             <div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
                             <img id="logo" class="img-responsive" src="${info.logo}"></img>
                             </div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10">
                             <span id="streamInfo" style="float: left">
                             <span style="font-size: 25px;"><b>${info.display_name}</b>
                             </span><br>--offline</span></div></div>
                             <span>${info.bio}</span></li>`);
                    });
                } else {
                    console.log(streams)
                    $("#main-group").append(`<li class="list-group-item btn btn-default"
                 style="white-space: normal; overflow: hidden;" >
                 <div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
                <img id = "logo" class="img-responsive" src="${streams.stream.channel.logo}">
                </img></div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10">
               <span id="streamInfo" style="float: left"><span style="font-size: 25px;">
                <b>${streams.stream.channel.display_name}</b></span>
                <br>${streams.stream.channel.status}</span></div></div>
                <span>${streams.bio}</span></li>`);
                }
            });


        }
    });
Eric Miller
@ericmiller777
Aug 16 2017 08:47
i see
@daddycardona thank you so much for all this
CamperBot
@camperbot
Aug 16 2017 08:48
ericmiller777 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:warning: ericmiller777 already gave daddycardona points
Eric Miller
@ericmiller777
Aug 16 2017 08:48
ill try and figure somthing out
or just get rid of the bio
Albert Cardona II
@daddycardona
Aug 16 2017 08:50
so the issue is that once you are in a getJson function the usersArray don't work
so you have to get the name a different way this is the way I was able to get it. I took this piece of code off stack overflow. basically an advance version of lastindexof and a string manipulation
 $(function() {

        var usersArray = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "habathcx", "RobotCaleb", "noobs2ninjas", "vgbootcamp"];
        var users;
        for (var i = 0; i < usersArray.length; i++) {

            $.getJSON("https://wind-bow.glitch.me/twitch-api/streams/" + usersArray[i], function(streams) {
                if (streams.stream === null) {
                    users = /[^/]*$/.exec(streams._links.self)[0];
                    $.getJSON("https://wind-bow.glitch.me/twitch-api/users/" + users, function(info) {
                        console.log(info);
                        $("#main-group").append(`<li class="list-group-item btn btn-default"
                             style="white-space: normal; overflow: hidden;" >
                             <div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
                             <img id="logo" class="img-responsive" src="${info.logo}"></img>
                             </div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10">
                             <span id="streamInfo" style="float: left">
                             <span style="font-size: 25px;"><b>${info.display_name}</b>
                             </span><br>--offline</span></div></div>
                             <span>${info.bio}</span></li>`);
                    });
                } else {
                    console.log(streams)
                    $("#main-group").append(`<li class="list-group-item btn btn-default"
                 style="white-space: normal; overflow: hidden;" >
                 <div class="row"><div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
                <img id = "logo" class="img-responsive" src="${streams.stream.channel.logo}">
                </img></div><div class="col-xs-8 col-sm-8 col-md-10 col-lg-10">
               <span id="streamInfo" style="float: left"><span style="font-size: 25px;">
                <b>${streams.stream.channel.display_name}</b></span>
                <br>${streams.stream.channel.status}</span></div></div>
                <span>${streams.bio}</span></li>`);
                }
            });


        }
    });
copy and paste that you will see the code in the the next line after if
@ericmiller777
Albert Cardona II
@daddycardona
Aug 16 2017 09:00
goodnigt/morning @ericmiller777 I just messed with your code nothimg more :)
Eric Miller
@ericmiller777
Aug 16 2017 09:18
Good night
Stephen James
@sjames1958gm
Aug 16 2017 09:27
@ericmiller777 If you use forEach over your array you will get a new context so you won't have that problem
usersArray.forEach(functtion(user) {
   // put your code here, using user rather than usersArray[i];
});
Replacing the for loop
clinton wambugu
@kwambugu
Aug 16 2017 10:17
Hi guys i dont know if am in the right place i recently installed ubuntu but that resulted in crashing my windows help am stuck as i can only access ubuntu side
Afiur Rahman Fahim
@faahim
Aug 16 2017 10:25
@kwambugu do you what boot system you are on? Legacy or UEFI?
Updating GRUB (Bootloader) may fix the problem.
Megan Brewer
@Meganbeccan
Aug 16 2017 10:40
Hello world
Hey guys I'm stucked pls
heroiczero
@heroiczero
Aug 16 2017 10:48
what do you need help with ?
Nicol
@NicolNonga
Aug 16 2017 12:07
@Meganbeccan hi what is the problem
rscales02
@rscales02
Aug 16 2017 12:57
function destroyer(arr) {
  // Remove all the values
  var toDestroy = arr[0];
  return toDestroy;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
toDestroy returns = 1, I thought that this would return the first object. Can someone explain to me why ([x,y,z],a,b,c) [x,y,z] is not treated as a single object?
Stuart Taylor
@Bouncey
Aug 16 2017 13:14

@rscales02 destroyer is passed three arguments [1, 2, 3, 1, 2, 3], 2, and 3. The function destroyer is only dealing with one argument, which is assigned to arr.

The first argument passed to destroyer will be assigned to arr. The other arguments can be accessed through the arguments object MDN arguments Object

Adetayo Timilehin
@Sprimage
Aug 16 2017 13:16
Hi, Im stuck trying to implement sessions on my express server and mysql database. Please I need help
rscales02
@rscales02
Aug 16 2017 13:17
@Bouncey thanks!
CamperBot
@camperbot
Aug 16 2017 13:17
rscales02 sends brownie points to @bouncey :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @bouncey |http://www.freecodecamp.com/bouncey
Stuart Taylor
@Bouncey
Aug 16 2017 13:18
@rscales02 you can access all arguments like so
function destroyer() {
    const args = [ ...arguments ];
    console.log(args[0]) // [1, 2, 3, 1, 2, 3]
    console.log(args[1]) // 2
}
@Sprimage Which part of it are you stuck on? And why use sql?
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:20
@Bouncey God thank you. Im using mysql because im more familiar with it. Im just trying to create a restricted page that allows only logged in users and display the username of logged in users on the dashboard
CamperBot
@camperbot
Aug 16 2017 13:20
sprimage sends brownie points to @bouncey :sparkles: :thumbsup: :sparkles:
:cookie: 388 | @bouncey |http://www.freecodecamp.com/bouncey
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:21
What do you suggest?
Stuart Taylor
@Bouncey
Aug 16 2017 13:23
Do you have authentication setup?
you could pass the request through middleware to check to see if they are logged in
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:24
Yes, with passport local strategy
Stuart Taylor
@Bouncey
Aug 16 2017 13:24
maybe reference a JSON Web Token?
My guess would be you can authenticate through middleware and route accordingly
rscales02
@rscales02
Aug 16 2017 13:25
Can someone explain to me the .filter function? I do not seem to grasp it at all.
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:25
create a new midddleware?
rscales02
@rscales02
Aug 16 2017 13:25
function destroyer(arr) {
  // Remove all the values
  var destroyed = [];
  for (var i = 1; i < 2; i++) {
    destroyed = arr.filter(function(kill) {
      arr = arguments[i];
    });
  }

  return destroyed;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:26
see my authentication
Julien Midedji
@ResamVi
Aug 16 2017 13:26
@rscales02 the filter is implemented wrong
@rscales02 a filter should return true or false
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:27
''
Julien Midedji
@ResamVi
Aug 16 2017 13:27
@Sprimage it creates a new array with all the values that evaluated to true
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:29
@Bouncey
passport.use(new LocalStrategy({
    usernameField : 'username',
    passwordField : 'password'
 },
    function(username, password, done) { // callback with username and password from our form
        connection.query("SELECT * FROM users WHERE username = '" +  username + "' ", function(err,rows){
                if (err){
                          return done(err);
                        }

                if (!rows.length) {
                          return done(null, false); // 
                      } 

                // if the user is found but the password is wrong
                if (!(password === rows[0].password)) {
                          return done(null, false); 
                }
                      // all is well, return successful user
                return done(null, rows[0]);   

                });

    }));
Where do I pass in the middleware?
rscales02
@rscales02
Aug 16 2017 13:29
Can you break down how it is going wrong? I have tried to set it as destroyed !== args[i] and that clearly is wrong too
@ResamVi
Stuart Taylor
@Bouncey
Aug 16 2017 13:29
const array = [1, 2, 3, 4, 5];

const newArray = array.filter(number => number > 2);

console.log(newArray); // [3, 4, 5]
Julien Midedji
@ResamVi
Aug 16 2017 13:30
@rscales02 can you tell me what you are expected to do, i cant tell from the code alone
rscales02
@rscales02
Aug 16 2017 13:30
expected to filter arg[1] for arg [2] and [3]
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:30
@ResamVi wait what?
Julien Midedji
@ResamVi
Aug 16 2017 13:31
@rscales02 i still don't quite get it. you mean you want to remove arg[1] and put arg[2] and arg[3] at its place?
rscales02
@rscales02
Aug 16 2017 13:32
it is the seek and destroy challenge
Stuart Taylor
@Bouncey
Aug 16 2017 13:32
@Sprimage if the user exists and the password is correct, route them to the page they requested, else route them to a login page or the home page
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:35
@Bouncey That's what the middleware will do right?
rscales02
@rscales02
Aug 16 2017 13:35
@Bouncey I have seen that example before, but I am trying to filter specific numbers and strings
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:35
@Bouncey This is authentication, im talking of persisting user sessions
pp.post('/login',
  passport.authenticate('local', { successRedirect:  '/dashboard.html',
                                   failureRedirect: '/login.html',
                                   failureFlash: true }),
  function(req, res) {
      req.session.user = true;
    }
);
The authentication i done and works fine, what i'm trying to do now is persisting users that are already logged in to access the dashboard page directly and getting new users to login first
get it?
Julien Midedji
@ResamVi
Aug 16 2017 13:38
@rscales02 so without telling you the solution, there is a fundamental problem
@rscales02 the filter function iterates the array twice stores it in destroyed, but overwrites the first one?
rscales02
@rscales02
Aug 16 2017 13:41
@ResamVi I could look up the answer so I appreciate you walking me slowly through it!
so I don't need a loop for this...
Julien Midedji
@ResamVi
Aug 16 2017 13:41
@rscales02 yea the filter serves as a loop, but wait let me figure it out
rscales02
@rscales02
Aug 16 2017 13:42
'''
CamperBot
@camperbot
Aug 16 2017 13:42
:bulb: to format code use backticks! ``` more info
rscales02
@rscales02
Aug 16 2017 13:43
function destroyer(arr) {
  // Remove all the values
  var destroyed = [];
  destroyed = arr.filter(arguments[2]);
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
returns "3 is not a function"
Julien Midedji
@ResamVi
Aug 16 2017 13:44
@rscales02
function destroyer(arr) {
  // Remove all the values
  var args = Array.prototype.slice.call(arguments, 1);
  return arr.filter(function(kill) {
      return args.includes(kill);
    });
}

console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));
my solution
@rscales02 there are multiple challenges in this exercise: getting the arguments that are NOT the array, storing them in an array, filtering
@rscales02 you want me to explain each step?
rscales02
@rscales02
Aug 16 2017 13:45
@ResamVi let me see if I understand...
Julien Midedji
@ResamVi
Aug 16 2017 13:46
@rscales02 if something still won't ring let me know. i don't want to explain something that is obvious to you :)
rscales02
@rscales02
Aug 16 2017 13:46
array.prototype.slice.call calls up the arguments from destroyer and slices them off starting at args[1]
Julien Midedji
@ResamVi
Aug 16 2017 13:46
exactly
this has to be done because arguments is not array, but an array-like object
i wanted to use includes though, so i had to convert it to an array
knight2
@knight2
Aug 16 2017 13:47
Has anyone gotten to the FCC beta Data Visualization Section? The thing seems to be buggy
Stuart Taylor
@Bouncey
Aug 16 2017 13:49
@Sprimage could you use session storage in the browser to hold a token that expires after so many minutes? You could hold valid tokens in memory on the server or persist then in the db?
Dhananjay Sood
@DhananjaySood
Aug 16 2017 13:50
Hi. is it necessary any js library while completing freecodecamp portfolio task?
to use
sorry typing mistake
Stuart Taylor
@Bouncey
Aug 16 2017 13:50
@DhananjaySood use anything you like
Julien Midedji
@ResamVi
Aug 16 2017 13:51
@DhananjaySood you can do everything without a library
Dhananjay Sood
@DhananjaySood
Aug 16 2017 13:51
@ResamVi @Bouncey hmm thanks
CamperBot
@camperbot
Aug 16 2017 13:51
dhananjaysood sends brownie points to @resamvi and @bouncey :sparkles: :thumbsup: :sparkles:
:cookie: 389 | @bouncey |http://www.freecodecamp.com/bouncey
:cookie: 325 | @resamvi |http://www.freecodecamp.com/resamvi
Julien Midedji
@ResamVi
Aug 16 2017 13:51
@DhananjaySood it's just you don't have to reinvent the
...wheel
Dhananjay Sood
@DhananjaySood
Aug 16 2017 13:51
@ResamVi okay
rscales02
@rscales02
Aug 16 2017 13:53
@ResamVi ```
return args.includes(kill)
I don't understand what that is really doing I guess
Julien Midedji
@ResamVi
Aug 16 2017 13:54
okay
we are using the filter function on the array
what filter does is loop over each element in the array, apply the function that is passed on
and the function that is passed, must return either true or false
if it's true it keeps the value, false it will be killed
args holds all the values that we want to be killed
Adetayo Timilehin
@Sprimage
Aug 16 2017 13:57
@Bouncey So, ill like to persist it on the db. But how? All the examples on Stack overflow are using mongo db and I dont want to switch just yet
rscales02
@rscales02
Aug 16 2017 13:57
so the .includes(kill) tells the filter function that kill basically = args?
Julien Midedji
@ResamVi
Aug 16 2017 13:57
if the current element (that is kill) is also the in the args array (meaning we must kill it)
kill is an element
Dhananjay Sood
@DhananjaySood
Aug 16 2017 13:58
one more ques, how can i work online if i know html,css,bootstrap and little bit of js?
Julien Midedji
@ResamVi
Aug 16 2017 13:58
i kept your variable name but a better name would actually be element simply
@rscales02 yea you got it basically
rscales02
@rscales02
Aug 16 2017 13:59
ok thanks! @ResamVi
CamperBot
@camperbot
Aug 16 2017 13:59
rscales02 sends brownie points to @resamvi :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @resamvi |http://www.freecodecamp.com/resamvi
Julien Midedji
@ResamVi
Aug 16 2017 13:59
@rscales02 it returns true if kill is inside args, not if "= args"
Stuart Taylor
@Bouncey
Aug 16 2017 13:59
@Sprimage can you insert them into a token table? I have never used SQL, so I am only guessing
Adetayo Timilehin
@Sprimage
Aug 16 2017 14:01
@Bouncey That's what im supposed to do, but It doesn't seem to go. Can i send the app pastebin privately to you?
rscales02
@rscales02
Aug 16 2017 14:12
that makes a little more sense @ResamVi thanks for the help.
CamperBot
@camperbot
Aug 16 2017 14:12
rscales02 sends brownie points to @resamvi :sparkles: :thumbsup: :sparkles:
:warning: rscales02 already gave resamvi points
Darren
@DarrenfJ
Aug 16 2017 14:34
morning fCC
Stuart Taylor
@Bouncey
Aug 16 2017 14:35
@Sprimage I would not have a clue when it comes to SQL
Stephen James
@sjames1958gm
Aug 16 2017 14:58
@DarrenfJ :wave:
Darren
@DarrenfJ
Aug 16 2017 15:04
@sjames1958gm hey buddy :D
Stephen James
@sjames1958gm
Aug 16 2017 15:04
@DarrenfJ How goes it?
Darren
@DarrenfJ
Aug 16 2017 15:05
@sjames1958gm busy busy but with non fCC stuff... and you?
Stephen James
@sjames1958gm
Aug 16 2017 15:06
@DarrenfJ About the same. We have a demo with Amazon tomorrow, sort of in a holding pattern to support the dry run
Darren
@DarrenfJ
Aug 16 2017 15:08
ah cool.. that sounds sorta exciting..
knight2
@knight2
Aug 16 2017 15:12
freeCodeCamp/freeCodeCamp#12762 The entire data visualization section is STILL bugged.
justinmcarlson
@justinmcarlson
Aug 16 2017 15:12
Can someone help me with this JSFiddle? I am trying to check the apropriate checkboxes when a link is clicked: http://jsfiddle.net/fhmfvvah/17/ I am getting an error that my array is not defined. I think it may be a scope problem?
Stephen James
@sjames1958gm
Aug 16 2017 15:15
@justinmcarlson Yes likely a scope problem - jsfiddle might wrap your js in a function which makes your variables inaccessble
Darren
@DarrenfJ
Aug 16 2017 15:15
@knight2 that in the beta?
i was doing the node stuff again via the beta, for fun and noticed the tests don't run
as well
:/
Stephen James
@sjames1958gm
Aug 16 2017 15:16
@justinmcarlson $(window).load(function(){ yes, looking in the devtools at the source you can see this function around your code
justinmcarlson
@justinmcarlson
Aug 16 2017 15:17
@sjames1958gm I was trying to do this in JQuery, but got stuck and tried to do it with just JS.
Julien Midedji
@ResamVi
Aug 16 2017 15:18
@justinmcarlson well vanilla js always worse lol
Darren
@DarrenfJ
Aug 16 2017 15:19
@knight2 thanks for sharing though
CamperBot
@camperbot
Aug 16 2017 15:19
darrenfj sends brownie points to @knight2 :sparkles: :thumbsup: :sparkles:
:cookie: 124 | @knight2 |http://www.freecodecamp.com/knight2
Darren
@DarrenfJ
Aug 16 2017 15:20
good to know progress
and thanks @sjames1958gm @ResamVi for helping justin out (for the brownies you missed).. i don't have the brainpower to do anything js today lol!
CamperBot
@camperbot
Aug 16 2017 15:21
darrenfj sends brownie points to @sjames1958gm and @resamvi :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @resamvi |http://www.freecodecamp.com/resamvi
:star2: 8326 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:21
how can i work online if i know html,css,bootstrap and little bit of js?
Julien Midedji
@ResamVi
Aug 16 2017 15:21
@DarrenfJ lol ty
CamperBot
@camperbot
Aug 16 2017 15:22
resamvi sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1972 | @darrenfj |http://www.freecodecamp.com/darrenfj
Darren
@DarrenfJ
Aug 16 2017 15:22
@DhananjaySood do you mean in general?
Stephen James
@sjames1958gm
Aug 16 2017 15:22
@justinmcarlson You can add a class to your <a> for example class="b2b" then add this code to your js
document.querySelector(".b2b").addEventListener("click", () => b2b.forEach(selectAddon));
Darren
@DarrenfJ
Aug 16 2017 15:22
@DhananjaySood like how can you get a job? or what projects are good to work on?
Stephen James
@sjames1958gm
Aug 16 2017 15:22
@DarrenfJ thx
CamperBot
@camperbot
Aug 16 2017 15:22
sjames1958gm sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1973 | @darrenfj |http://www.freecodecamp.com/darrenfj
justinmcarlson
@justinmcarlson
Aug 16 2017 15:24
@sjames1958gm Perfect! I will keep working on it.
Darren
@DarrenfJ
Aug 16 2017 15:24
@DhananjaySood there's a ton of tips on how people learned to code and got their first job... in the fCC forum: https://forum.freecodecamp.com/
@DhananjaySood and tips on doing open source projects to build up a portfolio
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:24
@DarrenfJ Like i have two years of experience in html, css and bootstarp. But i dont know if i can get a job rigth now or not?
Stephen James
@sjames1958gm
Aug 16 2017 15:24
@justinmcarlson Great - those online tools will isolate your js
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:25
I can code very well
sites like upwork or freelancer asks for basic cerfications which i dont have right now.
Darren
@DarrenfJ
Aug 16 2017 15:28
@DhananjaySood are you on the forum?
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:28
also they say to create portfolio on their site which should attract clients..
@DarrenfJ no
Darren
@DarrenfJ
Aug 16 2017 15:28
yah portfolios seem to be the way to go
join up.. there's tons of discussions on this.. but many people using fCC with 6 months to a year a get a job..and they often describe their path via a medium article
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:29
@DarrenfJ okay
that was 50 results
and they have a category on it too: https://forum.freecodecamp.org/c/getting-a-developer-job
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:31
okay
Darren
@DarrenfJ
Aug 16 2017 15:32
@DhananjaySood and P1xt built an additional guide to stuff to study to get job ready... that she now supports on GitHub https://forum.freecodecamp.org/t/computer-deprecated-guide-get-job-ready-with-1-fcc-cert-3-projects-2-courses-and-10-books/64027
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:32
hmm
Darren
@DarrenfJ
Aug 16 2017 15:33
@DhananjaySood this is it outside the forum (and up to date): https://github.com/P1xt/p1xt-guides/blob/master/job-ready.md
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:34
okay thanks a lot.
Darren
@DarrenfJ
Aug 16 2017 15:34
@DhananjaySood and this is one of many medium articles that suggests one way to get a job is build up a set of projects etc etc https://medium.freecodecamp.org/how-to-get-a-developer-job-in-less-than-a-year-c27bbfe71645
there's just so much information that anything I say will just be second hand information gleaned form these many resources I've read over time spent in the forums and reading medium articles...
@DhananjaySood also post your question in the forum and you are sure to get tons of people giving you their own tips on it...
Dhananjay Sood
@DhananjaySood
Aug 16 2017 15:39
@DarrenfJ Thanks I will
CamperBot
@camperbot
Aug 16 2017 15:39
dhananjaysood sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1974 | @darrenfj |http://www.freecodecamp.com/darrenfj
Aita Kane
@aita-kane
Aug 16 2017 15:52
@longnt80 ok thank you hope it's gonna work .. thank you
CamperBot
@camperbot
Aug 16 2017 15:52
aita-kane sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 507 | @longnt80 |http://www.freecodecamp.com/longnt80
Aita Kane
@aita-kane
Aug 16 2017 16:04
hello can someone help me please ??
gishy1
@gishy1
Aug 16 2017 16:24
hello world !!!
need help
image.png
hello universe!
?!?!?!
gishy1
@gishy1
Aug 16 2017 16:30
hello?
gishy1
@gishy1
Aug 16 2017 16:39
well isnt this akward
Dylan
@dhcodes
Aug 16 2017 16:42
hello!
@gishy1
what's up?
Dylan
@dhcodes
Aug 16 2017 16:42
that's a hard challenge
here goes
gishy1
@gishy1
Aug 16 2017 16:42
isnt really working
i tried replacing the verb noun
cat for dog
slowly for quickly
Ygor Dantas
@ygordantas
Aug 16 2017 16:43
the semicollon by the end of your sentence. You just forgot to close “"
Dylan
@dhcodes
Aug 16 2017 16:43
i think it's the extra " at the end
you don't need it
Ygor Dantas
@ygordantas
Aug 16 2017 16:44
you need for the “.” ;
gishy1
@gishy1
Aug 16 2017 16:44
removed it
Dylan
@dhcodes
Aug 16 2017 16:44
still doesn't work?
gishy1
@gishy1
Aug 16 2017 16:44
" " not good enough?
@dhcodes na bro
Ygor Dantas
@ygordantas
Aug 16 2017 16:45
myAdverb + “.” ;
Dylan
@dhcodes
Aug 16 2017 16:45
try what @ygordantas said
gishy1
@gishy1
Aug 16 2017 16:47
its saying ) is missing
Mike Batista
@mbmontana
Aug 16 2017 16:47

Hello, all. I'm back with the same problem I couldn't solve last night.

Profile Lookup challenge in Javascript.

Instructions: The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

The only line where I'm getting the error message is this one: {if (firstName == contacts[i]."firstName") Since the properties and property values are all strings, I thought this was the correct way to call the value of "firstName."

Or is my problem somewhere else?


//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
for (i = 0; i < contacts.length; i++)   
{if (firstName == contacts[i]."firstName") 
{if (contacts[i].hasOwnProperty[prop]) {
return contact[i][prop];}
 else {return "No such property";}}}
return "No such contact";



// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Ygor Dantas
@ygordantas
Aug 16 2017 16:47
@gishy1 copy your code here
Dylan
@dhcodes
Aug 16 2017 16:48
@gishy1 can you copy/paste what you have now
Ygor Dantas
@ygordantas
Aug 16 2017 16:48
Not the url. just the code :)
Dylan
@dhcodes
Aug 16 2017 16:48
@mbmontana you did not complete your first if
needs a {
gishy1
@gishy1
Aug 16 2017 16:49
result = "My " + " " + myAdjective+" " + myNoun+" "+ "thought" + " " + "it" + " " + "could" + " " + myVerb +" "+ myAdverb+ ".";
Dylan
@dhcodes
Aug 16 2017 16:49
@gishy1 can you paste all of it
gishy1
@gishy1
Aug 16 2017 16:49
that is all of it unless im missing something
Dylan
@dhcodes
Aug 16 2017 16:49
like the whole function
gishy1
@gishy1
Aug 16 2017 16:50

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "My " + " " + myAdjective+" " + myNoun+" "+ "thought" + " " + "it" + " " + "could" + " " + myVerb +" "+ myAdverb+ ".";

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran "quickly");

Ygor Dantas
@ygordantas
Aug 16 2017 16:50
for me your code worked
gishy1
@gishy1
Aug 16 2017 16:50
@dhcodes done
Ygor Dantas
@ygordantas
Aug 16 2017 16:50
Screen Shot 2017-08-16 at 11.49.47 AM.png
Dylan
@dhcodes
Aug 16 2017 16:50
try refreshing @gishy1
gishy1
@gishy1
Aug 16 2017 16:51
@dhcodes @ygordantas got it , was missing from the world blanks words.
Muchos gracias
Dylan
@dhcodes
Aug 16 2017 16:52
:+1:
gishy1
@gishy1
Aug 16 2017 16:53
@dhcodes @ygordantas so let me get this right any new element we re including in the string needs to be placed in '' '' before it can work?
if it wasnt in the string in the first place that is
Mike Batista
@mbmontana
Aug 16 2017 16:54
@dhcodes Where?
gishy1
@gishy1
Aug 16 2017 16:55
@dhcodes @ygordantas by element I mean word full stop number.
Ygor Dantas
@ygordantas
Aug 16 2017 16:55
does anybody know how I could use my generated text to post on twitter ? What I have so far is an api that generates quotes and I also have the twitter api to post on twitter. However I’m having trouble to save my random quote to a variable to them do some DOM with the twitter. I dont know if make sense for you guys :/
@gishy1 if it’s not a variable you have to put between quotes so is going to covert to a string :)
gishy1
@gishy1
Aug 16 2017 16:57
@ygordantas meaning it wasnt in the string in the first place.
@ygordantas im a a first time coder so i need language as simple as possible to use.
Ygor Dantas
@ygordantas
Aug 16 2017 17:02
@gishy1 I got you man, I am a first time coder too :p; Alright so you are creating a variable called result right. this variable is a string. So ever element you put in there should be a string as well so then it should be written in “”. Result = nom + “ has 1 dog"
in there you also have a number but is between quotes
if you wanna create a variable that contains different kinds of data you are gonna have to create an object (you are gonna see that in a near future on FCC)
gishy1
@gishy1
Aug 16 2017 17:03
@ygordantas ok so you have to make it in string form?
Ygor Dantas
@ygordantas
Aug 16 2017 17:04
Yes :)
gishy1
@gishy1
Aug 16 2017 17:06
@ygordantas thanks my understanding of the whole thing is improving
CamperBot
@camperbot
Aug 16 2017 17:06
gishy1 sends brownie points to @ygordantas :sparkles: :thumbsup: :sparkles:
:cookie: 263 | @ygordantas |http://www.freecodecamp.com/ygordantas
Ygor Dantas
@ygordantas
Aug 16 2017 17:07
@gishy1 anytime man. I know it can be really hard sometimes. If I could give you a advice. I would tell you to take one course on Udemy from Jonas about javaScript. It helped me a lot
gishy1
@gishy1
Aug 16 2017 17:08
@ygordantas oh man udemy and freecode camp at the same time .
thats alot.
@ygordantas ill check it out tho
its worth a try.
Ygor Dantas
@ygordantas
Aug 16 2017 17:10
@gishy1 I know man, but I fell after the course everthink makes more sense
so that is what I have so far… If someone could help me how to add my new generated quote to twitter that would be great.
I am doing in a harder way since I am using an api to generate the quotes instead of a homemade array. So , I am having a hard time to add the new quote to the twitter i.i
Stephen James
@sjames1958gm
Aug 16 2017 17:21
@ygordantas You are using the twitter widget which is more difficult to update the tweet for.
You can use twitter intents, which are easier to use.
https://dev.twitter.com/web/intents
Albert Cardona II
@daddycardona
Aug 16 2017 17:22
yes :)
That is what I did @sjames1958gm and @ygordantas too :)
Ygor Dantas
@ygordantas
Aug 16 2017 17:26
@sjames1958gm I’m reading right now. let me see if I can use it properly
Albert Cardona II
@daddycardona
Aug 16 2017 17:26
they basically give you everything you need you just have to add the content from your quote section :)
Stephen James
@sjames1958gm
Aug 16 2017 17:27
@ygordantas good look
Ygor Dantas
@ygordantas
Aug 16 2017 17:33
@daddycardona but that is my problem. Because I’m getting my quotes from a api. I did not create an array where I have all the quotes in there .
Screen Shot 2017-08-16 at 11.47.05 AM.png
Albert Cardona II
@daddycardona
Aug 16 2017 17:33
you have a quote in the #quote id section correct?
Ygor Dantas
@ygordantas
Aug 16 2017 17:33
I was trying to save the quote in a variable so I could do a DOM manipulation
yes
Albert Cardona II
@daddycardona
Aug 16 2017 17:34
once you have a quote in there then you have content and you can click twitter
the problem I see is that you giving a link vs the content and author of what you want to tweet
Mike Batista
@mbmontana
Aug 16 2017 17:35
@dhcodes Am I any closer here? I'm not getting any line errors but it's telling me contact is undefined
function lookUpProfile(firstName, prop){
// Only change code below this line
for (i = 0; i < contacts.length; i++)   
{if (firstName == contacts[i].firstName)
{if (contacts[i].hasOwnProperty(prop)) {
return contact[i][prop];}
 else {return "No such property";}}}
return "No such contact";



// Only change code above this line
}
Ygor Dantas
@ygordantas
Aug 16 2017 17:35
Yes but I need to link my quote to the href="https://twitter.com/intent/tweet?text=“ + MYNEWQUOTE
Albert Cardona II
@daddycardona
Aug 16 2017 17:36
yeah I was just about to post that tweet lol
Julien Midedji
@ResamVi
Aug 16 2017 17:36
gosh what kind of programming style is that
Albert Cardona II
@daddycardona
Aug 16 2017 17:36
link I mean
I don't see the what contacts is @mbmontana
Ygor Dantas
@ygordantas
Aug 16 2017 17:37
@daddycardona yes, my question is how can I save post.content in a variable that I can use it ?
Albert Cardona II
@daddycardona
Aug 16 2017 17:37
you have contacts[i] but you do not have contacts declared anywhere so it is not define what contacts is can you post your whole code
Ygor Dantas
@ygordantas
Aug 16 2017 17:38
I tried this but did not work : $('.twiter-share-button').html("https://twitter.com/intent/tweet?text="+ post.content )
Albert Cardona II
@daddycardona
Aug 16 2017 17:39
var mynewquote= getdocumentbyid('#quote') +'-'(getdocumentbyid('#author')
Ygor Dantas
@ygordantas
Aug 16 2017 17:39
let me try it out
Gulsvi
@gulsvi
Aug 16 2017 17:40

@ygordantas If you want to use the twitter widget code, replace your tweet button with an empty div with id="twitter" and then add this to your ajax success function:

  $("#twitter").empty();
  twttr.widgets.createShareButton("/", document.getElementById("twitter"), {
    size: "large",
    text: $("#quote").text()
  });

Fork: https://s.codepen.io/anon/pen/braNRZ?editors=1010
Documentation if you want to customize it further: https://dev.twitter.com/web/tweet-button/javascript-create

Albert Cardona II
@daddycardona
Aug 16 2017 17:41
I mean var mynewquote=$('#quote).html+'-'+$('#author').html; because you are using jquery
@ygordantas
Mike Batista
@mbmontana
Aug 16 2017 17:43
@daddycardona

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
for (i = 0; i < contacts.length; i++)   
{if (firstName == contacts[i].firstName)
{if (contacts[i].hasOwnProperty(prop)) {
return contact[i][prop];}
 else {return "No such property";}}}
return "No such contact";



// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Albert Cardona II
@daddycardona
Aug 16 2017 17:46
for (i = 0; i < contacts.length; i++)
{
    if (firstName == contacts[i].firstName){
         if (contacts[i].hasOwnProperty(prop)) {
                    return contact[i][prop];
    }else {
    return "No such property";
  }
  }
}
return "No such contact";
I am trying to make your code a little more readable
Julien Midedji
@ResamVi
Aug 16 2017 17:46
@mbmontana return contact[i][prop]; it says contact not contacts
Aita Kane
@aita-kane
Aug 16 2017 17:46
hello can you guys help me to fix the issue i'm having in the website i'm building please ??
Albert Cardona II
@daddycardona
Aug 16 2017 17:47
yes that might fix it
Julien Midedji
@ResamVi
Aug 16 2017 17:47
@mbmontana you dont see this kind of stuff if your code is that ugly quite frankly.
Albert Cardona II
@daddycardona
Aug 16 2017 17:48
@ResamVi you don't have to be rude about peole learning you need to teach them that it is hard to notice things when the code is so compact
Mike Batista
@mbmontana
Aug 16 2017 17:48
@ResamVi What do I need to do to clean up my code?
I figured compact would look better than run-on paragraphs.
Albert Cardona II
@daddycardona
Aug 16 2017 17:50
@mbmontana what you need to do is every function haves {} you should either do this
function(){ other stuf in here }
or
function() { other stuff in here }
that what i was not looking for lol
Julien Midedji
@ResamVi
Aug 16 2017 17:51
@mbmontana it depends on your editor, you can simply use the indend code command or use a beautify extension
Albert Cardona II
@daddycardona
Aug 16 2017 17:53
function(){
    // code in here
    if(){
        //code in here
    }else{
       // code in here
    }
}
// or 
function()
{
    //code in here
    if()
    {
        //code in here 
    }else
    {
        //code here
    }
}
Julien Midedji
@ResamVi
Aug 16 2017 17:54
visual code for example has https://imgur.com/a/pXPGX
Albert Cardona II
@daddycardona
Aug 16 2017 17:54
that make it look easier to read your code you know when something ends or begins in the and @ResamVi I just did that in vs code lol
Julien Midedji
@ResamVi
Aug 16 2017 17:55
@daddycardona vscode is the best thing since brackets!
Albert Cardona II
@daddycardona
Aug 16 2017 17:55
I never used brackets but once and I got confused trying to use it like the video lol
I love vscode they made it awesome and I like it better than sublime and notepad++
@mbmontana do you see how code should be displayed if you want to read it easier?
Julien Midedji
@ResamVi
Aug 16 2017 17:56
thing is notepad++ doesnt work on linux and sublime doesnt ship with a debugger so... :P
Albert Cardona II
@daddycardona
Aug 16 2017 17:58
LOL i don't like linux to me its just I love MS because I think they are awesome and Gates is too lol
for (i = 0; i < contacts.length; i++)
{
    if (firstName == contacts[i].firstName){
        if (contacts[i].hasOwnProperty(prop)) {
                    return contact[i][prop];
        }else {
            return "No such property";
        } 
    }
}
    return "No such contact";
@mbmontana this is your code clean, and now it is easier to see that in your second if statement your return contact should be return contacts did you fix that yet?
Julien Midedji
@ResamVi
Aug 16 2017 18:00
yea I held the same opinion at first but if you really start to commit to computer science you feel its inevitable
its an operating system made for developers
not for consumers
Aita Kane
@aita-kane
Aug 16 2017 18:00
anyone can tell what is the reason when your content goes out of the container
Albert Cardona II
@daddycardona
Aug 16 2017 18:00
Oh I think Linux is awesome just I don't care to change over yet LOL
your container is fixed and not fluint?
@aita-kane
@aita-kane what is your code? maybe we can help you with it is it on codepen or github
@ResamVi have you completed the roman numeral yet?
Aita Kane
@aita-kane
Aug 16 2017 18:03
@daddycardona the container is relative here is the pen : https://codepen.io/akane96/pen/zdPxwZ
Ygor Dantas
@ygordantas
Aug 16 2017 18:03
@SkyC0der Thank you
CamperBot
@camperbot
Aug 16 2017 18:03
ygordantas sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2412 | @skyc0der |http://www.freecodecamp.com/skyc0der
Albert Cardona II
@daddycardona
Aug 16 2017 18:04
your site looks amazing what content is going out of the container?
Julien Midedji
@ResamVi
Aug 16 2017 18:05
@daddycardona i did
Albert Cardona II
@daddycardona
Aug 16 2017 18:05
that one is kicking my ass the next one looks easier than that one lol
@aita-kane I don't see where your content is going outside the container are you looking at it in a smaller screen?
Julien Midedji
@ResamVi
Aug 16 2017 18:06
@daddycardona its easier than you expect it. you need to hardcore the numerals to their values though
Albert Cardona II
@daddycardona
Aug 16 2017 18:07
i did that
I had it done in 2 ways and just was like wth
@aita-kane you talking about this? <span class="text">Tous nos Produits</span>
Aita Kane
@aita-kane
Aug 16 2017 18:10
@daddycardona no i'm using it in my computer .. actually the grey area is a video
Capture d’écran 2017-08-16 à 18.09.26-fullpage.png
no i'm talking about the panel
n you see without the block with the class .r10 the website is like that
Albert Cardona II
@daddycardona
Aug 16 2017 18:12
oh yes I see what you talking about now
Aita Kane
@aita-kane
Aug 16 2017 18:14
Capture d’écran 2017-08-16 à 18.13.44-fullpage.png
the website is actually like that without the class r10 ... any thoughts about what causing it to be like that ??
@daddycardona
Albert Cardona II
@daddycardona
Aug 16 2017 18:16
No I don't I was trying to figure out how come you have a
source tag <source src="
@aita-kane
wouldn't you want the video tag to have the src
Aita Kane
@aita-kane
Aug 16 2017 18:18
is the source that contain the link of my video
it's work when i use here
Albert Cardona II
@daddycardona
Aug 16 2017 18:19
Okay let me go back and undo changes lol
Aita Kane
@aita-kane
Aug 16 2017 18:20
@daddycardona when you use in the video tag does the video appear ??
@daddycardona no problem :smile:
Albert Cardona II
@daddycardona
Aug 16 2017 18:21
no it does the same thing
why didnt you just import the one font?
like you did for the font
Aita Kane
@aita-kane
Aug 16 2017 18:24
@daddycardona anyrhing that might cause the content problem ??
Albert Cardona II
@daddycardona
Aug 16 2017 18:25
I am still trying to look if no one can answer here try www.dreamincode.net
Right now I am going to delete and add back many things to see if that one thing could be the problem, might be in your css
@aita-kane
Ryan Draves
@RyanDraves
Aug 16 2017 18:27
Hi, I have a React problem. I'm trying to call a parent method with a parameter passed, but instead each child initially calls the parent method similar to saying "onClick={this.method()}" How do I call the parent method with a parameter without triggering it on render?
Aita Kane
@aita-kane
Aug 16 2017 18:28
@daddycardona okkk thank you
CamperBot
@camperbot
Aug 16 2017 18:28
aita-kane sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 312 | @daddycardona |http://www.freecodecamp.com/daddycardona
Ryan Draves
@RyanDraves
Aug 16 2017 18:28
Nevermind, silly me forgot to just use "e" in the parent method. e.target.(attribute) fixed it
Albert Cardona II
@daddycardona
Aug 16 2017 18:30
when you trouble shoot an attenna you go from one section to the next so it could be the radio or the wire was broke or the antenna conecction on the radio is broke that is what I am trying to do with the css :) long process
@aita-kane I see something that makes it change, what is the green box?
Albert Cardona II
@daddycardona
Aug 16 2017 18:43
@aita-kane I would suggest you use that site LOL I can't figure it out
Aita Kane
@aita-kane
Aug 16 2017 18:43
@daddycardona nice technique... okay im going to check on it but anyway thank
CamperBot
@camperbot
Aug 16 2017 18:43
aita-kane sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:warning: aita-kane already gave daddycardona points
Albert Cardona II
@daddycardona
Aug 16 2017 18:44
when you get an answer let me know I probably saw it just did not notice it
Lorrie Pearson
@Lorrie01
Aug 16 2017 18:44
@aita-kane what are you trying to figure out? maybe I can help
or possibly @daddycardona you can fill me in on what @aita-kane is trying to accomplish?
Albert Cardona II
@daddycardona
Aug 16 2017 18:48
her video is not playing
Lorrie Pearson
@Lorrie01
Aug 16 2017 18:49
ok..is there a link to her project @daddycardona
Albert Cardona II
@daddycardona
Aug 16 2017 18:49
it is suppose to be on top I am thinking it might be a z-index I don't know lol
on top of the first grey section
scroll up :)
there you go
@Lorrie01
Lorrie Pearson
@Lorrie01
Aug 16 2017 18:50
thank you
Albert Cardona II
@daddycardona
Aug 16 2017 18:51
@Lorrie01 I am from worcester ma :) and live in douglas right now :)
Lorrie Pearson
@Lorrie01
Aug 16 2017 18:51
awesome @daddycardona
Albert Cardona II
@daddycardona
Aug 16 2017 18:54
so we almost family but I am a knicks fan for basketball lol
stashe86
@stashe86
Aug 16 2017 19:07
So I've started the Simon Game, and I've been doing everything in Atom on Chrome. I can't figure out how to format everything to fit multiple browsers. Here's the pen currently, which doesn't fit right in codepen either.
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:10
@stashe86 You probably would need to make the image responsive in some way
stashe86
@stashe86
Aug 16 2017 19:11
Yes, but it's not simply resolution is it?
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:12
I see, you are setting everything with absolute position, so responsive will not work
You probably want to get away from setting the positions absolute
stashe86
@stashe86
Aug 16 2017 19:13
Yes
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:13
and create an svg to make the shapes
That may help it to be more responsive
once you set the styles
stashe86
@stashe86
Aug 16 2017 19:14
Another problem is that my modal box doesn't work at all in IE
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:16
I am wondering, do you have all your styles prefixed?
using autoprefixer
stashe86
@stashe86
Aug 16 2017 19:16
on my other projects?
Albert Cardona II
@daddycardona
Aug 16 2017 19:16
@stashe86 just worry about the problems with chrome first then you can apply the styles you need to worry about another browser
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:16
on this project
stashe86
@stashe86
Aug 16 2017 19:17
I believe the modal box is the only responsive element i have
Eric Miller
@ericmiller777
Aug 16 2017 19:17
@sjames1958gm thank you I'll try that later, looks good tho
CamperBot
@camperbot
Aug 16 2017 19:17
ericmiller777 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8327 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:17
What I mean is that browsers implement CSS behaviors in differen ways
Therefore a tool, like https://github.com/postcss/autoprefixer, is necessary
Eric Miller
@ericmiller777
Aug 16 2017 19:18
@sjames1958gm thanks
CamperBot
@camperbot
Aug 16 2017 19:18
ericmiller777 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: ericmiller777 already gave sjames1958gm points
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:18
to make sure your project works cross-browser
Does that make sense @stashe86
stashe86
@stashe86
Aug 16 2017 19:18
it does now. this is the first project that i'm working on outside of codepen
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:18
Unless you want to write all the vendor prefixes by hand
stashe86
@stashe86
Aug 16 2017 19:18
i'm running into all sorts of issues that i didn't have before
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:19
Probabaly because codepen does vendor prefixing by default
I am not sure though
stashe86
@stashe86
Aug 16 2017 19:19
I would assume it does
Adam Recvlohe
@arecvlohe
Aug 16 2017 19:20
CodePen does a lot of nice stuff under the hood, so this is a good time to learn all the tools out there yourself
Albert Cardona II
@daddycardona
Aug 16 2017 19:20
Yes :)
stashe86
@stashe86
Aug 16 2017 19:20
I thought I should do it now, since I'm almost finished with front end development, and I haven't worked outside of codepen
Albert Cardona II
@daddycardona
Aug 16 2017 19:22
@stashe86 do you have your own domain and site?
stashe86
@stashe86
Aug 16 2017 19:25
No I don't
Albert Cardona II
@daddycardona
Aug 16 2017 19:26
oh when you do you will miss some of the options codepen haves lol
:)
later be back in an hour :)
Lorrie Pearson
@Lorrie01
Aug 16 2017 19:35
@aita-kane & @daddycardona hope this helps: https://codepen.io/lorrie/pen/MvrwLQ
Albert Cardona II
@daddycardona
Aug 16 2017 19:40
@Lorrie01 what was wrong with it?
Lorrie Pearson
@Lorrie01
Aug 16 2017 19:41
The code was incorrect. I added javaScript to make it work
Kent Saeteurn
@sansae
Aug 16 2017 19:42

hi everyone,
i have a general question (was searching for a general forum, but couldn't find one).
i have a bunch of code that i've written for coding problems, both from here at FreeCodeCamp and elsewhere. The problems were solved using javascript and ruby.

how can i share this with prospective employers? like, if they say, "do you have a site you'd like to share with us that demonstrates your coding ability?"

someone suggested to me a while ago that i should share this in a github repository. is this what you would recommend? if yes, how do i go about doing this? create a repo, and push my code to it when i have new code to push? how should i organize this? how can i make it presentable?

any suggestions/tips/advice would be great. thank you in advance

Albert Cardona II
@daddycardona
Aug 16 2017 19:42
what part of the code I am trying figure that out @Lorrie01
@sansae that is what your profile project is suppose to help you do
it's your portfolio of all the things you have done
Lorrie Pearson
@Lorrie01
Aug 16 2017 19:44
take a look at the JS. I deleted her HTML element as well @daddycardona
Albert Cardona II
@daddycardona
Aug 16 2017 19:48
I see looks awesome ;)
Yuserah Din
@YuserahN
Aug 16 2017 20:13
I'm working on an FCC challenge (Sum All Odd Fibonacci Numbers) and it froze. I'm unable to click on anything, not even 'Reset Your Code.' If I close it and return, it just takes me back to the same page and freezes again before I get a chance to do anything. Help! https://www.freecodecamp.org/challenges/sum-all-odd-fibonacci-numbers
I guess my solution made it crash. I don't know how to fix it.
Especially if I can't even click on anything.
Albert Cardona II
@daddycardona
Aug 16 2017 20:14
exit it out return to site
@YuserahN are you using mac or pc
Yuserah Din
@YuserahN
Aug 16 2017 20:14
I did. It just takes me back to the same page and freezes again.
PC
Albert Cardona II
@daddycardona
Aug 16 2017 20:18
what was your code?
you might need to clear your history it will reset all your code for all the challenges but you will be brought back to the challenge you are on because they have it in another database
Yuserah Din
@YuserahN
Aug 16 2017 20:20
Thank you. Clearing history also cleared the challenge.
Albert Cardona II
@daddycardona
Aug 16 2017 20:21
yes I know but your other challenges will be saved in their database as you passed them
Yuserah Din
@YuserahN
Aug 16 2017 20:22
Good, cuz I want those saved.

Can you tell me what was wrong with my code?

var fibArr = [1, 1];

var fibNum = 2;

fibArr.push(fibNum);

for(var i = 1; i < num; i++) {
fibNum = fibArr[i] + fibNum;

  fibArr.push(fibNum); 

}

return fibArr;
I was trying to store all the fibonacci numbers less than num into an array called fibArr. It made it crash.
Albert Cardona II
@daddycardona
Aug 16 2017 20:27
try fibNum+= fibArr[i] +fibNum;
you never mind I am trying to make sesne of it all can you post the whole code
Yuserah Din
@YuserahN
Aug 16 2017 20:29
Just a sec...
Albert Cardona II
@daddycardona
Aug 16 2017 20:30
okau
plau
okay LOL fingers not on home keys LOL
Yuserah Din
@YuserahN
Aug 16 2017 20:32
function sumFibs(num) { 

  var fibArr = [1, 1];  

  var fibNum = 2; 

  fibArr.push(fibNum); 

  for(var i = 1; i < num; i++) {
      fibNUm = fibNum[i] + fibNum; 

      fibArr.push(fibNum); 

} 

  return fibArr;
}

sumFibs(4);
Stephen James
@sjames1958gm
Aug 16 2017 20:34
@YuserahN You want to stop when fibNum > num not i
@YuserahN 4000000 this number will break your code.
Yuserah Din
@YuserahN
Aug 16 2017 20:36
@sjames1958gm Using fibNum > num prevented it from crashing. Thanks.
CamperBot
@camperbot
Aug 16 2017 20:36
yuserahn sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8329 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Albert Cardona II
@daddycardona
Aug 16 2017 20:38
also fibNum is not a array but you have it as fibNum[i] I am confused with that
Stephen James
@sjames1958gm
Aug 16 2017 20:40
@daddycardona good catch
Albert Cardona II
@daddycardona
Aug 16 2017 20:41
I think he wanted to do fibNum+=i;
Yuserah Din
@YuserahN
Aug 16 2017 20:41
@daddycardona Oh that was by mistake. I meant to write fibArr[i]. I couldn't copy and paste the code from the text editor because it was frozen, so I had to retype it on here and in a hurry and made a few mistakes.
In the text editor, it said fibArr[i].
Albert Cardona II
@daddycardona
Aug 16 2017 20:42
I honestly use vscode and code in it because it shows me mistakes before they happen somethimes
John Wilfred
@ewojjowe
Aug 16 2017 20:45
Hello all
I have something to share with you guys hihihi
Yuserah Din
@YuserahN
Aug 16 2017 20:46
@daddycardona Good idea
Albert Cardona II
@daddycardona
Aug 16 2017 20:47
dont forget it is fibNum not fibNUm you have that fibNUm = that
Hi @ewojjowe whats up
John Wilfred
@ewojjowe
Aug 16 2017 20:48
I'm now started working as a Web Developer, thanks to Freecodecamp. :)
Yuserah Din
@YuserahN
Aug 16 2017 21:03
@ewojjowe Congrats.
How long did it take you to find a job? And did you complete all the certificates on FCC, including the non-profit projects?
Travis Boss
@travisboss
Aug 16 2017 21:13
for me it took a year to get a web designer job
Chris
@bestintown23
Aug 16 2017 21:23
Good Afternoon, can anyone help with my slideshow, the slides are not showing in the correct timing and i cannot figure out why. https://codepen.io/bestintown23/pen/wqrPvy
Albert Cardona II
@daddycardona
Aug 16 2017 21:25
@ewojjowe congrats and awesome man :)
okay did you want to have 3s or 6s
@bestintown23
Chris
@bestintown23
Aug 16 2017 21:30
i want it to have 6s @daddycardona
Albert Cardona II
@daddycardona
Aug 16 2017 21:31
I see somethings are 3s is that something else?
I also see some other stuff for 10 and 12 s I am trying to see what those are for @bestintown23
I understand you wanted everything to show up in 6 seconds and then 12 etc lol my mistake on the last part
Albert Cardona II
@daddycardona
Aug 16 2017 21:37
I am guessing you want it to take 3s for the transition ot the next pic @bestintown23
Albert Cardona II
@daddycardona
Aug 16 2017 21:43
I would suggest you do a script to change the images. @bestintown23 this way looks very confusing to me
Travis Boss
@travisboss
Aug 16 2017 21:49
@bestintown23 http://css3.bradshawenterprises.com/cfimg/ see here for transitions
Albert Cardona II
@daddycardona
Aug 16 2017 21:55
@travisboss nice site I might just start using that lol
Chris
@bestintown23
Aug 16 2017 22:31
@travisboss thanks i started reading into this site yesterday, guess i need to finish up.
CamperBot
@camperbot
Aug 16 2017 22:31
bestintown23 sends brownie points to @travisboss :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @travisboss |http://www.freecodecamp.com/travisboss
aRtoo
@artoodeeto
Aug 16 2017 22:52
is my fibonaci correct?

function sumFibs(num) {

  var frst = 0;
  var scnd = 1;
  var res = 0;

  for(var i=0; i<num; i++){
    res = frst + scnd;
    frst = scnd;
    scnd = res;
  }


  return res;
}

sumFibs(4);
Gersho
@Gersho
Aug 16 2017 22:53
@artoodeeto does it work ?
aRtoo
@artoodeeto
Aug 16 2017 22:54
@Gersho this is just for me. i wanted to answer it again its not in the challenge
Mike Batista
@mbmontana
Aug 16 2017 22:57
Just finished the Basic Javascript part of FCC. I just want to make sure I understand the last challenge because it kind of zipped through regular expressions. Why is there no plus sign needed after the cap S in the expression?
// Setup
var testString = "How many non-space characters are there in this sentence?";

// Only change code below this line.

var expression = /\S/g;  // Change this line

// Only change code above this line

// This code counts the matches of expression in testString
var nonSpaceCount = testString.match(expression).length;
Margaret
@Margaret2
Aug 16 2017 22:57
@mbmontana because you have the g flag for "global", that means it will go through the whole string and look for non-space characters
Gersho
@Gersho
Aug 16 2017 22:58
@mbmontana well according to you, why would it be needed ?
Margaret
@Margaret2
Aug 16 2017 22:58
^ that too
Mike Batista
@mbmontana
Aug 16 2017 22:58
@Gersho I only ask because the previous regular expression challenges all used the plus sign.
Gersho
@Gersho
Aug 16 2017 22:59
@mbmontana @Margaret2 i only apply a basis of troll logic, when someone asks a question, ask them why they're asking
CamperBot
@camperbot
Aug 16 2017 22:59
:trollface: troll problems? notify admins here
Gersho
@Gersho
Aug 16 2017 22:59
usefull when learning
Mike Batista
@mbmontana
Aug 16 2017 23:00
So maybe the plus isn't needed because with inversion we're looking for something that ISN'T a space?
Margaret
@Margaret2
Aug 16 2017 23:00
@mbmontana just because you used them doesn't mean they were necessary lol
Gersho
@Gersho
Aug 16 2017 23:00
and if you ask me, you shouldn't worry too much about regular expression right now, even assuming you learned it, you'd still need the documentation nearby ^^
Margaret
@Margaret2
Aug 16 2017 23:00
"+" means "at least 1", so there's no reason to always have it
Jake
@JakeDVirus
Aug 16 2017 23:03

The syntax for jquery's getJSON method is stated as

$.getJSON(url,data,success(data,status,xhr))

where the parameters of success are given as:

data - contains the data returned from the server.
status - contains a string containing request status ("success", "notmodified", "error", "timeout", or "parsererror").
xhr - contains the XMLHttpRequest object

Now how do i pass the argument to the callback function success if i need to retrieve only the xhr.
if i pass like this success(xhr), won't it be treated as success(data)?
what is the proper way?

Margaret
@Margaret2
Aug 16 2017 23:04
@mbmontana i also like http://regexone.com, has some additional challenges if you want to try them
Gersho
@Gersho
Aug 16 2017 23:05
i'm looking for some challenges where you need to use constructors if you know some ;)
Margaret
@Margaret2
Aug 16 2017 23:05
nope, i just like regex :wink:
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:07
Margaret
@Margaret2
Aug 16 2017 23:07
maybe there will be something on codeschool, they're coming up with their free days soon
about constructors ^
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:08
It looks like the right side is centered. But why?
Gersho
@Gersho
Aug 16 2017 23:10
is that a Simehhhh challenge ?
@HappyViki so you want the block of 5 squares to be centered in the middle of the black rectangle ?
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:12
@Gersho yup
to both
Gersho
@Gersho
Aug 16 2017 23:14
apart from text-align: center; assigned to .btn i don't see where's you're asking stuff to be centered
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:17
@Gersho I thought .center was centering it.
Gersho
@Gersho
Aug 16 2017 23:17
.center {
  width: 700px ;
  margin-left: auto ;
  margin-right: auto ;
}
or did you change it since i loaded the doc ?
it's not asking anything apart from width
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:21
I thought that’s supposed to center it.
Gersho
@Gersho
Aug 16 2017 23:21
well i'm on expert on CSS, so don't quote me on this
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:22
how would you do it?
I looked up how to center divs and that’s what showed up.
Gersho
@Gersho
Aug 16 2017 23:22
but i always assumed that "auto", would be the setting that's on even when you don't ask it
how about the text align center you used on the btn ? putting it on .center ( iirc .center regroups all your btn)
also i don't really understand your use of row and container, but like i said, i'm no css expert so i'm assuming there's some reason
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:25
I want an expert :(
Gersho
@Gersho
Aug 16 2017 23:26
:D
the Simon's CSS annoyed me to the point i went for everything in fixed position D:
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:31
lol
I WANT IT TO CENTER!! I almost found something that worked...
Gersho
@Gersho
Aug 16 2017 23:36
btw
.centerplz{
text-align: center;
}
didn't work ? it works fine for me when i center btn
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:37
I want to center a div
@Gersho maybe I can inline it
Gersho
@Gersho
Aug 16 2017 23:39
be it a div or whatever, i don't see what if changes
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:40
it only works on text and buttons
and what do you need to center apart from text and button ?
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:47
@Gersho I need to center the pink div
Ahmed Tarek
@ahmedtarek2134
Aug 16 2017 23:48
@HappyViki how do you want to center the div
both ways I recommend flexbox
just have a parent div with a width 100vw if you want it horizontal
then add this code to the parent div
.parent-div {
  display: flex;
  justify-content: center;
}
if you want it vertical
change the "justify-content" to "align-items"
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:51
@Gersho @ahmedtarek2134 updates try: http://vvv.rent-a-mind.com/projects/bah-bah-arwen/index.html
I used <center>
Gersho
@Gersho
Aug 16 2017 23:51
@HappyViki ii ended up with pink in the middle using fixed position for it instead of absolute, but, you know, you should probably listend to Ahmed instead
@HappyViki i used <center> until last week too, and upon learning it's deprecated had to redo stuff on most of my challenges :(
it works but don't use it (yeah i know worst advice ever)
Ahmed Tarek
@ahmedtarek2134
Aug 16 2017 23:53
@HappyViki you shouldn't use position absolute to center stuff
as it will break on small devices
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:53
what, why? @Gersho
@ahmedtarek2134 but I want the stupid pink box to float above it and that’s how w3schools did it
Gersho
@Gersho
Aug 16 2017 23:54
deprecated (meaning they are gonna remove it soon)
Ahmed Tarek
@ahmedtarek2134
Aug 16 2017 23:54
<center> is from html4
that's why
@HappyViki what do you mean float above it? above what?
Gersho
@Gersho
Aug 16 2017 23:54

@HappyViki

.center {

 text-align: center;
}

#face {
    width: 200px;
    height: 200px;
    margin-top: 100px;
    margin-left: 450px;
    background: #b8008a;
    position: fixed;
    text-align: center;
    z-index: 1;
}

that's what i changed in your css to have it all centered

Ahmed Tarek
@ahmedtarek2134
Aug 16 2017 23:56
@HappyViki you can change the height and width of the container div to span the whole screen
and then use flexbox to position your elements
position absolute will cancel any flexbox properties applied so you have to remove any position: absolute first
or you can actually center the pink div with position absolute
but you need a fixed height and width
Veronica Eulenberg
@HappyViki
Aug 16 2017 23:58
@ahmedtarek2134 Looks like this worked, thanks!
.parent-div {
  display: flex;
  justify-content: center;
}
CamperBot
@camperbot
Aug 16 2017 23:58
happyviki sends brownie points to @ahmedtarek2134 :sparkles: :thumbsup: :sparkles:
:cookie: 581 | @ahmedtarek2134 |http://www.freecodecamp.com/ahmedtarek2134
Ahmed Tarek
@ahmedtarek2134
Aug 16 2017 23:58
@HappyViki happy to help brother :+1: