These are chat archives for FreeCodeCamp/HelpFrontEnd

17th
Dec 2016
Callum Ward
@callumquick
Dec 17 2016 00:00
@emilyaringoen Your code must be incorrect somewhere, you're missing a semicolon or a bracket or something
MoJoe13
@MoJoe13
Dec 17 2016 00:00
@Waqas909 You're a life saver. Now, I'll get a beer and relax for a while to recharge my batteries. Thanks again, and take care.
CamperBot
@camperbot
Dec 17 2016 00:00
mojoe13 sends brownie points to @waqas909 :sparkles: :thumbsup: :sparkles:
:warning: mojoe13 already gave waqas909 points
Waqas Abbasi
@Waqas909
Dec 17 2016 00:01
Haha cheers :+1:
Callum Ward
@callumquick
Dec 17 2016 00:01
Night all
Waqas Abbasi
@Waqas909
Dec 17 2016 00:01
Btw @MoJoe13 Your Html code has alot of Divs, so it helps if you just close the ones you're not using
by clicking the tiny arrow left of a div
Night
Jean Marco Romero
@volkranium
Dec 17 2016 00:09
Supp bros and sis
somebody struggling with JS?
feeling all they know is syntax?
or somebody went through that?
Waqas Abbasi
@Waqas909
Dec 17 2016 00:10
Hello
Not sure if it's a call for help or it's you asking for help :P
call for help as in you wanting to help people :P
Jean Marco Romero
@volkranium
Dec 17 2016 00:11
hahahaha
both
i need help
but i want people in the same struggle to get help
Waqas Abbasi
@Waqas909
Dec 17 2016 00:13
Haha in that case, we've all been through that phase. Of learning something, and wondering how to apply it :P , If u need help just ask. Somebody might be able to help
DennisLoska
@DennisLoska
Dec 17 2016 00:14
@volkranium if you feel like that I bet you did not work on an own project? I´m also new to JS, but coming from Java, so yeah it´s about solving problems. Create your own page and think about some cool stuff you want to implement with JS, and then it won´t be only syntax, but something you created and know how the algorithms behind that work.
Waqas Abbasi
@Waqas909
Dec 17 2016 00:14
I learnt python an year ago, and had to idea to apply it.. so i forgot everything overtime
But I'm glad I found FCC, because I'm not only able to learn, but they give us Projects to make!
Well Unless you have finished the FCC course... There should be plenty things for you to apply your knowledge on!
Jean Marco Romero
@volkranium
Dec 17 2016 00:16
@DennisTalmid yes its true , the problem is the things im doing right now dont require JS or thats what i think, cause i know little about the language
maybe thats a solution
Waqas Abbasi
@Waqas909
Dec 17 2016 00:17
@volkranium What Are you on?
Jean Marco Romero
@volkranium
Dec 17 2016 00:17
studying a bit more about what it does
Waqas Abbasi
@Waqas909
Dec 17 2016 00:17
as in what challenge/ lesson are u on
Jean Marco Romero
@volkranium
Dec 17 2016 00:18
@Waqas909 i took treehouse front end courses , but i got stuck in their JS , now im working on the FCC JS
Compound Assignment With Augmented Addition
Waqas Abbasi
@Waqas909
Dec 17 2016 00:21
@volkranium It's important you go through Learning all the Syntax, before actually applying it, but you technically are applying it by solving each JS lesson. You're not that far from applying this knowledge
DennisLoska
@DennisLoska
Dec 17 2016 00:21
I also used to do those courses, because I thought I need to do those before creating things - well I was wrong. Those courses are great if you need more information about how to use stuff so you can implement that. For example I did the bootstrap part on FCC like a year ago, but forgot everything. But when I actually created a website using bootstrap, it was a much better learning experience. imho these courses are a good start-point and to get back for reviewing, but should not keep you from creating own projects
Waqas Abbasi
@Waqas909
Dec 17 2016 00:21
@volkranium Basic Algorithm Scripting, is where u have to start applying your knowledge
They give u challenges, and u have to use your JS knowledge to solve problems!
Jean Marco Romero
@volkranium
Dec 17 2016 00:22
@Waqas909 hmmm thanks for your advice
CamperBot
@camperbot
Dec 17 2016 00:22
volkranium sends brownie points to @waqas909 :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @waqas909 |http://www.freecodecamp.com/waqas909
Jean Marco Romero
@volkranium
Dec 17 2016 00:22
@DennisTalmid thats so true , thanks
CamperBot
@camperbot
Dec 17 2016 00:22
volkranium sends brownie points to @dennistalmid :sparkles: :thumbsup: :sparkles:
:cookie: 126 | @dennistalmid |http://www.freecodecamp.com/dennistalmid
Jean Marco Romero
@volkranium
Dec 17 2016 00:23
i guess imma continue my quest
DennisLoska
@DennisLoska
Dec 17 2016 00:23
@volkranium you can also have the best of both worlds, for example make a portfolio page using pure css or even a css-framework, where you put in all finished challenges etc.
and with JS you could create some effects like moving pictures or I don´t know, it is about creating things - be creativ mate
Jean Marco Romero
@volkranium
Dec 17 2016 00:24
@DennisTalmid thats a good idea...
@DennisTalmid maybe creating auto playing slideshows
for photographers i know
Damn i love this chat
DennisLoska
@DennisLoska
Dec 17 2016 00:25
you could even build a page, where the html is almost completely generated using JS - thats the next project I want tro start btw
Waqas Abbasi
@Waqas909
Dec 17 2016 00:25
Yea I Love it to
Jean Marco Romero
@volkranium
Dec 17 2016 00:25
can you guys believe there almost no coders here in this country?
DennisLoska
@DennisLoska
Dec 17 2016 00:25
:D
Waqas Abbasi
@Waqas909
Dec 17 2016 00:25
Where from?
Jean Marco Romero
@volkranium
Dec 17 2016 00:26
Dominican Republic
DennisLoska
@DennisLoska
Dec 17 2016 00:26
just hover over my pic, it gives you all the information
Waqas Abbasi
@Waqas909
Dec 17 2016 00:26
He hasnt specified it in his profile ^^
Jean Marco Romero
@volkranium
Dec 17 2016 00:26
everything here is done with templates , Dreamwaver , blah blah
@DennisTalmid hey man good luck with that , sounds interesting...
Waqas Abbasi
@Waqas909
Dec 17 2016 00:27
then if u want to pursue in this field
it's kind of good for u
because less competition
and you'll be like the one of the few people who actually understands what he's doing :D
Jean Marco Romero
@volkranium
Dec 17 2016 00:28
@Waqas909 yes i know , thats what im striving for
Waqas Abbasi
@Waqas909
Dec 17 2016 00:28
i live in a pretty well developed city
and Computer science was just introduced
like 1 year ago
so... it's the same case here
Jean Marco Romero
@volkranium
Dec 17 2016 00:28
@Waqas909 Netherlandss
Waqas Abbasi
@Waqas909
Dec 17 2016 00:29
Yep :P
In my school*
Forgot to mention that :P
Jean Marco Romero
@volkranium
Dec 17 2016 00:29
@Waqas909 that fkn nice , i was about to go to a metal fest
Waqas Abbasi
@Waqas909
Dec 17 2016 00:29
haha nice
Jean Marco Romero
@volkranium
Dec 17 2016 00:29
@Waqas909 called Netherlands Deathfest
DennisLoska
@DennisLoska
Dec 17 2016 00:30
@volkranium thanks, well it is the next step for me after html and css becoming easy js is next. just today i created my first JS-game, to learn dom-manipulation - so yeah I didn´t know the syntax lol, it was all just working with the W3C tutorial and previous knowledge of Java
CamperBot
@camperbot
Dec 17 2016 00:30
dennistalmid sends brownie points to @volkranium :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for volkranium
Waqas Abbasi
@Waqas909
Dec 17 2016 00:30
we have crazy things here
@DennisTalmid Can i see your js game :P
Jean Marco Romero
@volkranium
Dec 17 2016 00:31
@DennisTalmid and what are doing after learning the front-end? , i wanna do some python , but thats after i become a front end master
DennisLoska
@DennisLoska
Dec 17 2016 00:31
shure, let me get the link
Waqas Abbasi
@Waqas909
Dec 17 2016 00:32
The thing with python is, there's alot of website which teach u the syntax, but not anything like FCC, not any website which properly challenge you with projects and actual challenges
Waqas Abbasi
@Waqas909
Dec 17 2016 00:32
which is kind of why My brain slowly faded away from python
Jean Marco Romero
@volkranium
Dec 17 2016 00:32
@Waqas909 and hows your city different from Amsterdam ?
@Waqas909 hmmm i see , ill find my way through python as ill do with JS
Waqas Abbasi
@Waqas909
Dec 17 2016 00:33
@volkranium It's very Different, Like VERY
It's like 100% more peaceful and quiter
Jean Marco Romero
@volkranium
Dec 17 2016 00:33
@Waqas909 sounds nice , i love quite... is there a lot of green there?
Waqas Abbasi
@Waqas909
Dec 17 2016 00:33
people are genuinely much nice like 100%, less theft. Good Infrusture and Very Green
and Full of Old people
Like everywhere u turn around
Jean Marco Romero
@volkranium
Dec 17 2016 00:34
@Waqas909 ohh thats awesome
Waqas Abbasi
@Waqas909
Dec 17 2016 00:34
there's always one old lady
atleast*
the only problem is, that it has less opportunities for people in our field
Jean Marco Romero
@volkranium
Dec 17 2016 00:34
@Waqas909 dont u like that? im 22 but i prefer to be around old people
DennisLoska
@DennisLoska
Dec 17 2016 00:34
@volkranium I don´t want to be a frontend-dev actually, but I find it very interesting. And right now, it fits in my scedule to learn that. After that, I want to learn backend-dev with node.js for small projects and java for enterprise-scale-apps. Well but thats only trhe plan for now, since I like the frontend-stuff so far, but it gets less payed :D
Waqas Abbasi
@Waqas909
Dec 17 2016 00:34
haha, I meant it in a good way :)
I think it's full of old people because of how Peaceful it is
Jean Marco Romero
@volkranium
Dec 17 2016 00:35
@DennisTalmid feel ya , someday ill be a fullstack warlock from hell
Waqas Abbasi
@Waqas909
Dec 17 2016 00:35
xD
Jean Marco Romero
@volkranium
Dec 17 2016 00:35
@Waqas909 or its the other way around xD
Waqas Abbasi
@Waqas909
Dec 17 2016 00:36
o.o
could be
DennisLoska
@DennisLoska
Dec 17 2016 00:36
@Waqas909 I was also thinking about python, but since node.js is so popular and uses JS, I´m more into that, but Python is 2nd on my list when I think about scripting languages
Waqas Abbasi
@Waqas909
Dec 17 2016 00:36
Yea @DennisTalmid I started off programming with Python, because it's so very Easy
It's very good for small programs
DennisLoska
@DennisLoska
Dec 17 2016 00:37
true
Waqas Abbasi
@Waqas909
Dec 17 2016 00:37
but yea Node.js is more sexi
DennisLoska
@DennisLoska
Dec 17 2016 00:37
@volkranium yeah, but first the basics - then the full-stack talk lol
Waqas Abbasi
@Waqas909
Dec 17 2016 00:37
yup :)
also Python is very good language if you're like an engineer (Machines, robots etc.
Jean Marco Romero
@volkranium
Dec 17 2016 00:38
@Waqas909 @DennisTalmid Yo guys dont hesitate to chat me privately , ill go back to my JS challenges , thank you very much for your help...
CamperBot
@camperbot
Dec 17 2016 00:38
volkranium sends brownie points to @waqas909 and @dennistalmid :sparkles: :thumbsup: :sparkles:
:warning: volkranium already gave waqas909 points
:warning: volkranium already gave dennistalmid points
DennisLoska
@DennisLoska
Dec 17 2016 00:38
if you saw the js game I shared you will know, I realy just started with Js but if you look for example at http://blog.nowsee.me you see that I still could pull of some frontend-stuff withouut even using JS actively lol
Waqas Abbasi
@Waqas909
Dec 17 2016 00:38
@volkranium Was nice talking to you Thanks as well
CamperBot
@camperbot
Dec 17 2016 00:38
:warning: could not find receiver for volkranium
waqas909 sends brownie points to @volkranium :sparkles: :thumbsup: :sparkles:
Jean Marco Romero
@volkranium
Dec 17 2016 00:38
@DennisTalmid Of course , step by step ...
Waqas Abbasi
@Waqas909
Dec 17 2016 00:38
@DennisTalmid Yea the game was awesome!
Just that you can choose like 5 cards at once if u click fast enough xD
a good challenge would be to limit it to two :P
aight cya lads as well gonna work on my Twitch viewer
DennisLoska
@DennisLoska
Dec 17 2016 00:40
yes it isn´t the best algorithm, I agree its pretty bad, but at least you can reset it haha
@Waqas909 @volkranium see u around
Jean Marco Romero
@volkranium
Dec 17 2016 00:41
@DennisTalmid Yoooo how did u doo that parallax on the headerr!!!
Jacob
@jdc101214
Dec 17 2016 00:42
Ive got a question about .replace.
Can you use a variable as the parameter, such as
var me = "hello"; 
var text = "hello world";
var answer = text.replace(me);
DennisLoska
@DennisLoska
Dec 17 2016 00:43
@volkranium it is realy just a bit css, very cheap
Waqas Abbasi
@Waqas909
Dec 17 2016 00:44
Yup @jdc101214 However, .replace() requires 2 inputs, .replace("What you want to replace", "With what you want to replace the text by")
DennisLoska
@DennisLoska
Dec 17 2016 00:44
let me look that up one sec
Jacob
@jdc101214
Dec 17 2016 00:44
@Waqas909 That wasent a literal example.
DennisLoska
@DennisLoska
Dec 17 2016 00:44
and do you mean the color-change or the picture?
@jdc101214 mate check W3C they explain all syntax-issues pretty good!
:)
DennisLoska
@DennisLoska
Dec 17 2016 00:46
@volkranium
.section-showcase {
    height: $showcase-height;
    text-align: center;
    background-color: whitesmoke;
    margin-bottom: 0;
    background-image: url(../../img/showcase.jpg);
    background-attachment: fixed;
    background-repeat: no-repeat;
    h2 {
        margin-top: 20%;
        margin-bottom: 20px;
        font-size: 4em;
        text-shadow: 2px 2px #ffffff;
        color: $primary;
    }
    p {
        color: white;
        text-shadow: 1px 1px $primary;
    }
}
you can ignore the h2 and p selectors, those are the headline on the picture
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 00:47
DennisLoska
@DennisLoska
Dec 17 2016 00:47
since I used SASS these are nested in the .section-showcase, but don´t get distracted by that
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 00:47
now only if the emulator starts working properly
DennisLoska
@DennisLoska
Dec 17 2016 00:48

@volkranium

    background-image: url(../../img/showcase.jpg);
    background-attachment: fixed;
    background-repeat: no-repeat;

so basically this is what you want to ctrl+c :)

Jacob
@jdc101214
Dec 17 2016 00:49
@DennisTalmid W3 schools didnt say anything about my situation. that i could see.
Waqas Abbasi
@Waqas909
Dec 17 2016 00:50
@jdc101214 Can u describe/ give a description of what you want to do?
Jacob
@jdc101214
Dec 17 2016 00:50
Someone else helped me
DennisLoska
@DennisLoska
Dec 17 2016 00:50
xD
Jacob
@jdc101214
Dec 17 2016 00:50
I looked at that.
DennisLoska
@DennisLoska
Dec 17 2016 00:50

Syntax

  • string.replace(searchvalue, newvalue)
Jacob
@jdc101214
Dec 17 2016 00:50
THey didnt say anything to my situation.
Waqas Abbasi
@Waqas909
Dec 17 2016 00:51
well we cant really help you if we dont know what you want to achieve
Jacob
@jdc101214
Dec 17 2016 00:51
But mozzila did
DennisLoska
@DennisLoska
Dec 17 2016 00:51
jacob
you can use a variable that way of course
Jacob
@jdc101214
Dec 17 2016 00:51
Ive got a question about .replace.
Can you use a variable as the parameter, such as
var me = "hello"; 
var text = "hello world";
var answer = text.replace(me);
@Waqas909
Waqas Abbasi
@Waqas909
Dec 17 2016 00:51
yea you can :P
Jacob
@jdc101214
Dec 17 2016 00:51
That was my question.
lol
Waqas Abbasi
@Waqas909
Dec 17 2016 00:52
wait one sec
DennisLoska
@DennisLoska
Dec 17 2016 00:52
yes, but you also have to give the newValue, not only the searchValue
Jacob
@jdc101214
Dec 17 2016 00:52
I understand.
Why is this code not working?
function destroyer(arr) {
  // Remove all the values
  var arr1 = "";
  for(var i = 0; i < arguments.length; i++){
    arr1 = arguments[0[i]].replace(arguments[i], "");
  }

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Waqas Abbasi
@Waqas909
Dec 17 2016 00:53
@jdc101214 It's Arguments[0][i]
DennisLoska
@DennisLoska
Dec 17 2016 00:53
I answered you that one pretty detailed in another room, if you didn´t see that.
Waqas Abbasi
@Waqas909
Dec 17 2016 00:53
Also http://www.w3schools.com/jsref/jsref_replace.asp actually explains your situation xD
DennisLoska
@DennisLoska
Dec 17 2016 00:54

@DennisTalmid
according to the syntax:

  • array.filter(function(currentValue, index, arr), thisValue)

you should do:

yourArray.filter(destroyer([1, 2, 3, 1, 2, 3], 2, 3));

Or somehting similar, I am sorry I didn´t read the challenge, but in general this would be the apporach if I am not mistaken
and if you want to replace the removed values with " " for example, you do:

var arr1 =" ";
yourArray.filter(destroyer([1, 2, 3, 1, 2, 3], 2, 3),arr1);
Jacob
@jdc101214
Dec 17 2016 00:54
@DennisTalmid Im trying another way.
But ill try that.
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 00:55
anyone had their hands on native script ?
Waqas Abbasi
@Waqas909
Dec 17 2016 00:55
arr1 = arguments[0[i]].replace(arguments[i], "");  // you can't access arrays like this.

you need to use arguments[0][i]
Jacob
@jdc101214
Dec 17 2016 00:55
@Waqas909 I changed that but It brought another error.
Waqas Abbasi
@Waqas909
Dec 17 2016 00:55
What error would that be :P ?
Jacob
@jdc101214
Dec 17 2016 00:55
var arr1 =" ";
yourArray.filter(destroyer([1, 2, 3, 1, 2, 3], 2, 3),arr1);
Its not copying....
DennisLoska
@DennisLoska
Dec 17 2016 00:57
well it was more of an general example - not the exact solution! but it´s a good starting-point, since at least the syntax should be fine.
Jacob
@jdc101214
Dec 17 2016 00:57
replace is a string method. It would work with what Im trying to do
Waqas Abbasi
@Waqas909
Dec 17 2016 00:57
I think the problem is
function destroyer(arr)

Your input name is arr

And you use "argument" instead 
 arguments.length
nvm
ignore that
Just remembered argument %_%
"Replace is a string method" means that you can use .replace on variables that are not strings
cant*
and your input is numbers
DennisLoska
@DennisLoska
Dec 17 2016 00:59
he gives arr in the parameter, but doesn´t use it in the function.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:00
Yea "argument.length" basically means the same thing as arr.length @DennisTalmid
DennisLoska
@DennisLoska
Dec 17 2016 01:00
ah ok
Waqas Abbasi
@Waqas909
Dec 17 2016 01:01
@jdc101214 Your input to the function are integers, and .replace only works on strings
DennisLoska
@DennisLoska
Dec 17 2016 01:01
integers in JS :D
Jacob
@jdc101214
Dec 17 2016 01:01
lol
Waqas Abbasi
@Waqas909
Dec 17 2016 01:02
numbers*
it should work if you put your numbers ["1","2","3"]
DennisLoska
@DennisLoska
Dec 17 2016 01:02
again syntax:
  • string.replace(searchvalue, newvalue)
string lol
Waqas Abbasi
@Waqas909
Dec 17 2016 01:03
Yea ^^ Exactly my point, He's Function input are numbers and not strings
DennisLoska
@DennisLoska
Dec 17 2016 01:03
but the good thing about JS is it should compile numbers to strings without any problems i think
Waqas Abbasi
@Waqas909
Dec 17 2016 01:03
Unfortunately it doesn't that is why he gets an error "Replace is a string method"
DennisLoska
@DennisLoska
Dec 17 2016 01:04
well it works with numbers only
not shure about that array though
yeah
the array does not work
you need to make that array to numbers or to a string
Joshua
@jfc246
Dec 17 2016 01:05
Waqas Abbasi
@Waqas909
Dec 17 2016 01:05
@jdc101214 I Think you're doing it your own way, which is good but the Challenge requires you to learn .filter()
DennisLoska
@DennisLoska
Dec 17 2016 01:06
like if you do destroyer([1, 2, 3, 1, 2, 3].toString(), 2, 3); it will work.
since in js 2 == "2"
for example
Waqas Abbasi
@Waqas909
Dec 17 2016 01:07
@DennisTalmid Will it not convert the entire array into 1 string?
DennisLoska
@DennisLoska
Dec 17 2016 01:08
yses
Joshua
@jfc246
Dec 17 2016 01:08
destroyer??? @DennisTalmid
@DennisTalmid and how would i convert that to a string?
DennisLoska
@DennisLoska
Dec 17 2016 01:09
@jfc246 I was speaking about Jacobs problem
he posted it up above
Joshua
@jfc246
Dec 17 2016 01:09
@DennisTalmid ok.
DennisLoska
@DennisLoska
Dec 17 2016 01:11
@Waqas909 of course you can make demoArray[i].toString() - I just wanted a prove of concept that numbers do work in the string replace-function
Waqas Abbasi
@Waqas909
Dec 17 2016 01:11
@DennisTalmid Yea but that's only if they are written as a string
then yea the numbers work
DennisLoska
@DennisLoska
Dec 17 2016 01:11
qwa
@Waqas909 what do you mean by written as strings?
Jacob
@jdc101214
Dec 17 2016 01:12
@Waqas909 @DennisTalmid Sorrry, I had to make some nachos for dinner.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:12
"2"
instead of 2
"2" = string
2 = number
DennisLoska
@DennisLoska
Dec 17 2016 01:12
no, then it would be a string xD
you can do string.replace(searchString,2); for example
Waqas Abbasi
@Waqas909
Dec 17 2016 01:13
:P
DennisLoska
@DennisLoska
Dec 17 2016 01:13
the browser then compiles the 2 then to "2" for u
Waqas Abbasi
@Waqas909
Dec 17 2016 01:13
But we were talking about the "string.replace" part
yea ofc :P
@jdc101214 I think the best solution is to follow the challenge!
To learn about .filter()
Jacob
@jdc101214
Dec 17 2016 01:13
The argument of the day! :wink:
@Waqas909 Ya, I reliazed that about 15 min ago.
DennisLoska
@DennisLoska
Dec 17 2016 01:14
well justr trya it out here for example and change the arguments
Waqas Abbasi
@Waqas909
Dec 17 2016 01:14
@jdc101214 It's great you have your own way, but it's more efficent to use filter()
DennisLoska
@DennisLoska
Dec 17 2016 01:14
you learn more by doing it your way though
but it is often the harder one also
Waqas Abbasi
@Waqas909
Dec 17 2016 01:15
But then he'll never about new and faster things ^^
he needs to step out of his comfort zone to try out new methods :D
DennisLoska
@DennisLoska
Dec 17 2016 01:15
well the thing is to do it yourself andf then to see different implementations
Jacob
@jdc101214
Dec 17 2016 01:16
Like I haven't already. lol
Waqas Abbasi
@Waqas909
Dec 17 2016 01:16
xD
Jacob
@jdc101214
Dec 17 2016 01:16
I did that about 3 yrs ago....
Waqas Abbasi
@Waqas909
Dec 17 2016 01:16
btw your .replace function wasn't working because you were inputting numbers
so the computer was reading it as 2.replace
e.g*
Jacob
@jdc101214
Dec 17 2016 01:16
replace is a string method. It would work with what Im trying to do
Waqas Abbasi
@Waqas909
Dec 17 2016 01:16
nope
you're feeding your function an array with numbers
DennisLoska
@DennisLoska
Dec 17 2016 01:17
for example I used to solve an algorithm in java with 1 Array and 2 ArrayLists, when I could have just used 1 HashSet lol. I learned a lot about ArrayLists, and also then looked up the HashSet class :smile: )
Jacob
@jdc101214
Dec 17 2016 01:17
:point_up: replace is a string method. It would work with what Im trying to do
Waqas Abbasi
@Waqas909
Dec 17 2016 01:17
.=.
DennisLoska
@DennisLoska
Dec 17 2016 01:18
well , but the compiler won´t compile an array-object to a string-object for you sadly
Jacob
@jdc101214
Dec 17 2016 01:18
Trying to point you to where I said that like 30min ago before you starting arguing.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:18
I did tell u
but u were busy making nachos
like 30 mins ago ^^

I think the problem is
~~~
function destroyer(arr)

Your input name is arr

And you use "argument" instead
arguments.length
~~~

DennisLoska
@DennisLoska
Dec 17 2016 01:19
well me personally never argued, it was a conversation about the js-compiler doing this his way
Waqas Abbasi
@Waqas909
Dec 17 2016 01:19
that message
Yea i mean he was talking about something else, and i was like what's going on :package:
and then i realised he was talking about the parameters
xDDD
DennisLoska
@DennisLoska
Dec 17 2016 01:20
well at least everybody has learned something
Jacob
@jdc101214
Dec 17 2016 01:20
Why cant they make these easy....
Waqas Abbasi
@Waqas909
Dec 17 2016 01:20
"Replace is a string method" means that you can use .replace on variables that are not strings
cant*
and your input is numbers
If they are easy, you wont learn as much! simple as that
Jacob
@jdc101214
Dec 17 2016 01:21
true.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:21
What's the point of them even being a challenge if they are not even challenging :P
Jacob
@jdc101214
Dec 17 2016 01:21
FIGURED IT OUT!
Finally.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:21
_> Took you a while to read my comment xD
Jacob
@jdc101214
Dec 17 2016 01:21
Thanks you guys. @Waqas909 @DennisTalmid
CamperBot
@camperbot
Dec 17 2016 01:21
jdc101214 sends brownie points to @waqas909 and @dennistalmid :sparkles: :thumbsup: :sparkles:
:cookie: 127 | @dennistalmid |http://www.freecodecamp.com/dennistalmid
:cookie: 281 | @waqas909 |http://www.freecodecamp.com/waqas909
Waqas Abbasi
@Waqas909
Dec 17 2016 01:21
so let's see that solution!
Joshua
@jfc246
Dec 17 2016 01:21
@jdc101214 good job :clap:
Jacob
@jdc101214
Dec 17 2016 01:21
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0, 1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}
@jfc246 You had nothing to do with this.
DO your own stuff
DennisLoska
@DennisLoska
Dec 17 2016 01:22
LOL
Joshua
@jfc246
Dec 17 2016 01:22
@jdc101214 ok.......
Waqas Abbasi
@Waqas909
Dec 17 2016 01:22
xD
i think he was inspecting us this whole time :P
DennisLoska
@DennisLoska
Dec 17 2016 01:22
well I´m sad I don´t see the replace-function anymore :D
Joshua
@jfc246
Dec 17 2016 01:22
@DennisTalmid @Waqas909 he is my older brother :smile:
Jacob
@jdc101214
Dec 17 2016 01:22
@DennisTalmid lol
Waqas Abbasi
@Waqas909
Dec 17 2016 01:23
nice brother learning coding together
i wish my brother was into computers..
Jacob
@jdc101214
Dec 17 2016 01:23
Yep. Im the to go helper for him.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:23
instead he's playing on his android all day
Jacob
@jdc101214
Dec 17 2016 01:23
He dosent have to rely on chat, at least for now.
Joshua
@jfc246
Dec 17 2016 01:23
@Waqas909 that is NOT me
Waqas Abbasi
@Waqas909
Dec 17 2016 01:23
wow FeelsBadMan You abused us!!! U didnt even use the replace function
gonan report u for harrasment xD
well atleast you learned how to use .filter
Jacob
@jdc101214
Dec 17 2016 01:24
@Waqas909 it seemed like a waste of space. :wink:
Waqas Abbasi
@Waqas909
Dec 17 2016 01:24
yea but it works so.. Idk ur point :D
aight great banter, gonna work
now
DennisLoska
@DennisLoska
Dec 17 2016 01:25
That makes me think about starting those challenges too.
been active on FCC one year ago, maybe it is more fun with chitchat indeed
I´m done for now too - thanks for the time and have a good time coding all.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:26
:+1:
Sam Griffen
@ssgriffen
Dec 17 2016 01:30
Anyone know why my search history items when clicked are loading in the wiki articles? http://codepen.io/ssgriffen/pen/KNraGP
Jacob Jackson
@bearswamppastor
Dec 17 2016 01:33
I have, what are probably, some simple questions about adding images. Can anyone help?
Waqas Abbasi
@Waqas909
Dec 17 2016 01:34
@bearswamppastor Sorry can you rephrase ur question?
Jacob Jackson
@bearswamppastor
Dec 17 2016 01:35
@Waqas909 I have some questions about adding images to a website using bootstrap.
Waqas Abbasi
@Waqas909
Dec 17 2016 01:35
@bearswamppastor Go ahead and ask ! Perhaps someone can help you
@ssgriffen <form autocomplete="off">
that should turn your history off
add that property to your form element
@ssgriffen http://www.w3schools.com/tags/att_input_autocomplete.asp if you want to see it in action and read more about it
Jacob Jackson
@bearswamppastor
Dec 17 2016 01:38

I know this code (<img src="my-image.png" alt="My Image">) will work for adding images to my tribute page using bootstrap. But I have some really dumb questions.

  1. When getting an image offline do I just copy and past the image url into the quotations?

  2. Can I pull an image from my computer?

  3. If I can't pull an image from my computer, but want to use one I have do I just post that image online?

  4. If I pull offline do I use the <a href="http://website.com">

Waqas Abbasi
@Waqas909
Dec 17 2016 01:41

Unfortunately, you can't pull it directly from your computer. You have to upload it an image website. When it is done uploading, right click it and click "Open image in a new tab", copy paste the address and use it for <img src="Your address link from the image u just copied">

Oh btw There are no dumb questions :-)

If you add <a href=" Link> then it will give it an anchor, which means when that picture is clicked, the link in "href" will open!
@bearswamppastor https://imgsafe.org/ Try this website :-)
You can just upload it, and click on the image and it'll give you a url
Waqas Abbasi
@Waqas909
Dec 17 2016 01:46

Hope it was clear. Sorry I could have structured my answer better!

Oh Extra Information. Bootstrap is a framework. So for your tribute page, make sure to add it in the settings --> CSS --> Quick Add.

Jacob Jackson
@bearswamppastor
Dec 17 2016 01:54
@Waqas909 Thank you!
CamperBot
@camperbot
Dec 17 2016 01:54
bearswamppastor sends brownie points to @waqas909 :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @waqas909 |http://www.freecodecamp.com/waqas909
Nicolas Poore
@nicopoore
Dec 17 2016 02:31
hey guys can anyone help me with bootstrap?
specifically how to center images inside columns
i've tried everything i could think of and searched google but none of the answers seem to solve it, i must be missing something
i'm trying to get the dog images (they are placeholders haha) to be centered regardless of the screen size, so margins don't help me as they are hard code and changing the screen size doesn't change the margins, so they only work for specific screens
numoonchld
@numoonchld
Dec 17 2016 02:43
so i was hoping to get some help with Copepen.io suppressing my window.open()
what is the correct way to use <a target='_blank'>.
to workaround that
Jacob
@jdc101214
Dec 17 2016 02:51
function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  var arr1 = arr.sort(function(a, b){return a-b;});
  var arr2 = "";
  for(var i = 0; i < arr.length; i++){
    if(num < arr1[i]){
      arr2 = arr1.unshift(num);
      return i;
    } 
  }


}

getIndexToIns([40, 60], 50);
Why is this code not working?
Javier Rivera
@jrivera27
Dec 17 2016 03:39
My carousel was switching pictures automatically just fine, I started working on my social media stuff and noticed a little later on that my carousel stopped working. Can anyone assist on getting it working again? http://codepen.io/jrivera27/full/GNPEbG/
Michael Bomholt
@bomholtm
Dec 17 2016 04:08
hey does anyone know a possibility to add 2 functionalities to 1 button? ... like clinking does one thing and holding the button for a longer period of time does something different? needs to work on mobile too
JamesHaengsin
@JamesHaengsin
Dec 17 2016 04:08
Hello, I was hoping someone could help me figure out why my header is sticking to the right. https://codepen.io/CaseyR/pen/LbMdLN
Michael Bomholt
@bomholtm
Dec 17 2016 04:10
@JamesHaengsin what do you mean by sticking to the right?
JamesHaengsin
@JamesHaengsin
Dec 17 2016 04:12
@bomholt Hey! So when I look at the page it has a white gap in my header. But the tribute page is purely black. I thought it might be a padding or margin thing, but I tried changing that and the white gap is still there.
Tom
@moT01
Dec 17 2016 04:13
body has a default margin
probly what it is
you can see it by opening the inspector
anony456
@anony456
Dec 17 2016 04:14
@bomholt If you are using jQuery you could try building an event for click and an event for mousedown for the same button.
Michael Bomholt
@bomholtm
Dec 17 2016 04:15
@anony456 the first project i'm trying to accomplish everything without jquery though :( but thanks =)
CamperBot
@camperbot
Dec 17 2016 04:15
bomholt sends brownie points to @anony456 :sparkles: :thumbsup: :sparkles:
:cookie: 36 | @anony456 |http://www.freecodecamp.com/anony456
Michael Bomholt
@bomholtm
Dec 17 2016 04:16
@JamesHaengsin you mean the gap left and right?
anony456
@anony456
Dec 17 2016 04:17
@bomholt You can check this out then. Hopefully this could help. I should read this myself since I love jQuery alot.
JamesHaengsin
@JamesHaengsin
Dec 17 2016 04:17
@bomholt yeah. I tried to set the margin for the whole thing to 0. and padding as well, but the gap stayed.
Tom
@moT01
Dec 17 2016 04:20
@JamesHaengsin i believe it's your row div
Michael Bomholt
@bomholtm
Dec 17 2016 04:23
@JamesHaengsin actually its .container-fluid and its padding
set it to 0
wasnt sure what you meant with gap on the right as its on both sides for me
@anony456 thanks =)
CamperBot
@camperbot
Dec 17 2016 04:24
bomholt sends brownie points to @anony456 :sparkles: :thumbsup: :sparkles:
:warning: bomholt already gave anony456 points
Waqas Abbasi
@Waqas909
Dec 17 2016 04:26
What do you guys reckon the best way of active searching is? So the results update as your typing the search thing?
Michael Bomholt
@bomholtm
Dec 17 2016 04:26
@JamesHaengsin read some stuff on chrome developer tools and you will be able to find stuff like that by yourself. its REALLY helpful
Waqas Abbasi
@Waqas909
Dec 17 2016 04:27
Or rather how do i check that the thing they typed in the search
matches with some sort of a name
so if they type "Henr" and press Enter
They should get results with "Henry"
"Henrrryy"
.-.
JamesHaengsin
@JamesHaengsin
Dec 17 2016 04:29
@bomholt Thank you! I appreciate your help. I will find some resources to learn about chrome developer tools. Thank you for the advice. It is much needed.
CamperBot
@camperbot
Dec 17 2016 04:29
jameshaengsin sends brownie points to @bomholt :sparkles: :thumbsup: :sparkles:
:cookie: 558 | @bomholt |http://www.freecodecamp.com/bomholt
Tom
@moT01
Dec 17 2016 04:29
i think there's like a keyup() method in jquery, not sure, but you could maybe use to that to update the results every time a key is pressed (or lifted i guess) @Waqas909
Michael Bomholt
@bomholtm
Dec 17 2016 04:30
@JamesHaengsin i dont know if its still there but FCC had a section for that too
Tom
@moT01
Dec 17 2016 04:30
@JamesHaengsin there's a video challenges section in the freecodecamp map that is quick
Michael Bomholt
@bomholtm
Dec 17 2016 04:31
@JamesHaengsin https://www.freecodecamp.com/map-aside#nested-collapseChromeDeveloperTools here you go ... its a new one haven't done it myself but should be great
Tom
@moT01
Dec 17 2016 04:35
@Waqas909 i answered your first question, ...the second one maybe could be some regular expression
thenote
@thenote
Dec 17 2016 04:38
hello
Tom
@moT01
Dec 17 2016 04:39
hey
thenote
@thenote
Dec 17 2016 04:39
which is good php or js?
for backend
Tom
@moT01
Dec 17 2016 04:40
php
anony456
@anony456
Dec 17 2016 04:40
I don't think JS is used for Backend...
Tom
@moT01
Dec 17 2016 04:40
not sure if js qualifies as backend
thenote
@thenote
Dec 17 2016 04:41
Does FCC teaches us any backend lang?
Tom
@moT01
Dec 17 2016 04:41
there is a backend section
thenote
@thenote
Dec 17 2016 04:41
i know that
but which lang?
??
Are Node.js & Express.js Backend lang.??
Tom
@moT01
Dec 17 2016 04:43
im not sure on those
but they are in the backend section
sparklie3
@sparklie3
Dec 17 2016 04:48
can anyone help me with this? I have links in my codePen to watch a stream: http://codepen.io/sparklie3/pen/Pbyapm?editors=1010
the links work, by opening a new page, but twitch.tv doesn't load
if i right click on the link and say open in a new tab, it does work
?? why ??
@thenote yes, FCC teaches javascript for backend
using node.js and express.js
those are packages that enable backend to run javascript using Chrome V8
c0d0er
@c0d0er
Dec 17 2016 04:51
does anybody know why in my codepen (http://codepen.io/c0d0er/pen/ObwGPM?editors=0010), the right end of search filed, the search icon is correctly shown, but in my local file it shows error in the console and the search icon doesnt show correctly?
Capture.PNG
Tom
@moT01
Dec 17 2016 04:53
@sparklie3 there was a post on here a week or so ago about the url for that api changed i think
sparklie3
@sparklie3
Dec 17 2016 04:53
my api all work since i'm able to pull the data
and generate the codepen
i'm just trying to figure out why twitch.tv doesn't load when i open it via clicking the Watch Stream
but it works when i right click on the link the then say open new window
wasn't 100% if that was just unique to me
it seemed to be chrome specific issue
because when i try the same thing in IE, it works
so was just wondering
Tom
@moT01
Dec 17 2016 04:58
yea, when i open in new tab it loads right away, and clicking watch it just keeps loading
strange
same url
sparklie3
@sparklie3
Dec 17 2016 05:01
yeah, that's the thing i can't figure out
and i think it's unique to chrome
i tried this in IE and didn't have the issue
i think chrome is doing something with the target="_blank"
different than IE
Tom
@moT01
Dec 17 2016 05:03
im on firefox
sparklie3
@sparklie3
Dec 17 2016 05:03
oh?
damn
Tom
@moT01
Dec 17 2016 05:04
not sure exactly what your getting, mine just keeps loading and doesn't ever load
sparklie3
@sparklie3
Dec 17 2016 05:04
so on my chrome, if i click on the link watch stream
it opens a new tab
and loads blank
if I right click and then open the tab
everything is fine
on IE, if i just click on the link, it's fine
c0d0er
@c0d0er
Dec 17 2016 05:07
@TylerMoeller thanks
CamperBot
@camperbot
Dec 17 2016 05:07
c0d0er sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1165 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
eadc-p
@eadc-p
Dec 17 2016 05:08
Hi guys. I am trying to build a random quote machine. cant find a suitable ai.
Tom
@moT01
Dec 17 2016 05:09
quotesondesign.com
@c0d0er im trying to take a look at your issue, ...not sure
you didn't make any changes on pen and then not make them locally
feels like a styling issue
eadc-p
@eadc-p
Dec 17 2016 05:10
thnx @moT01 . was stuck on this for 3 hours
CamperBot
@camperbot
Dec 17 2016 05:10
eadc-p sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 415 | @mot01 |http://www.freecodecamp.com/mot01
c0d0er
@c0d0er
Dec 17 2016 05:11
@moT01 if you can look at the picture i sent earlier, sounds like fonts problem
thenote
@thenote
Dec 17 2016 05:11
is php better than express.js & Node.js? Do i need to learn php?
eadc-p
@eadc-p
Dec 17 2016 05:12
thanks @moT01
CamperBot
@camperbot
Dec 17 2016 05:12
eadc-p sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:warning: eadc-p already gave mot01 points
Tom
@moT01
Dec 17 2016 05:13
sure thing, @eadc-p there's a pretty easy to read api docs page there
@c0d0er yea, i wonder, you getting the same thing on all browsers locally?
c0d0er
@c0d0er
Dec 17 2016 05:17
@moT01 yes
Tom
@moT01
Dec 17 2016 05:17
@c0d0er i didnt get into reading them, but a google of 'glyphicon search icon not working' brings up a number of results of other people who had similar issues
one result says ...
Setup your fonts folder on the same level as your css folder, where bootstrap is located, and put the glyphicon fonts there. Then find the following lines in your bootstrap css file and make sure they also point to the font folder.
Tom
@moT01
Dec 17 2016 05:24
well, i wont post the rest, ...ask if you want the link
c0d0er
@c0d0er
Dec 17 2016 05:25
@c0d0er thanks
CamperBot
@camperbot
Dec 17 2016 05:25
sorry c0d0er, you can't send brownie points to yourself! :sparkles: :sparkles:
Tom
@moT01
Dec 17 2016 05:25
i bet that's it
Tiffany White
@twhite96
Dec 17 2016 05:32
Helllo. Can someone help me with the Weather App?
I am using the Dark Sky API, Skycons, and ipify
All APIs
I can link to what I have
Kinda lost as to where to go next
I’d like the background to change when the weather does. Not sure how to go about that but I am searching
Tom
@moT01
Dec 17 2016 05:42
ill take a look
you can do that with jquery, ...set an icon or background, to some html element if certain weather conditions are met
Fernand
@Ferdyboy81
Dec 17 2016 05:44
hey guys im working on a website only HTML/CSS how do i setup a separate page? like if i click on help, i want it to open up a new page
Tom
@moT01
Dec 17 2016 05:44
if(weatherobject.temp > 90) {
  $(".weatherimage").attr(src, "hoticon.jpg");
}
something like that is one way to go
@twhite96 the api i used had links to icons in the object so it was easy, ...not sure what your getting
@Ferdyboy81 <a href="help.html">HELP!</a>
Tiffany White
@twhite96
Dec 17 2016 06:04
@moT01 I’m using this https://darkskyapp.github.io/skycons/
Tom
@moT01
Dec 17 2016 06:11
your object did have an icon, just a label, ...and the different type of labels are listed in their api docs
Adam Faraj
@adamfaraj
Dec 17 2016 06:22
I have a quick question
I tried Googling it, but to no avail.
I'm doing Project #1, Build a Tribute Page.
I'm trying to center my unordered list. The text will center, but the bullet points will not
here is my code:
<ul class="text-center">
<li>Born in England</li>
<li>Moved to New York</li>
<li>Was in a rap group called KMD</li>
<li>Group was dropped</li>
<li>Brother died</li>
<li>Left rap for nearly a decade</li>
<li>Came back as MF DOOM</li>
<li>Wore a metal mask to protect his identity and people focused on the lyrics rather than looks</li>
</ul>
Sorin Ruse
@sorinr
Dec 17 2016 06:24
@adamfaraj you can try in css: ul{display: block;margin-left:50%;transform: translate(-50%);}
Adam Faraj
@adamfaraj
Dec 17 2016 06:25
@sorinr didn't work :(
Sorin Ruse
@sorinr
Dec 17 2016 06:25
@adamfaraj can you post the link to your pen?
Sorin Ruse
@sorinr
Dec 17 2016 06:28
@adamfaraj it should work. here an example get rid of the text-center class
Adam Faraj
@adamfaraj
Dec 17 2016 06:29

@sorinr so use this code:

<div class="row">
<div class="col-xs-6"><div class="well"></div>
</div>
<div class="col-xs-6"><div class="well"></div>

</div>
</div>

Sorin Ruse
@sorinr
Dec 17 2016 06:30
@adamfaraj like new example
Adam Faraj
@adamfaraj
Dec 17 2016 06:32
ahhh
so it was the first 2 lines in my CSS
@sorinr so why was this messing that up:
text-align: center
margin: 0px auto;display:block
Sorin Ruse
@sorinr
Dec 17 2016 06:35
@adamfaraj think you where no closing the text-center css the right way .text-center{here the rules to be applied}
Adam Faraj
@adamfaraj
Dec 17 2016 06:36
thanks @sorinr !
CamperBot
@camperbot
Dec 17 2016 06:36
adamfaraj sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 959 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Dec 17 2016 06:37
@adamfaraj instead of inline-table you can also use block
@adamfaraj np
@adamfaraj welcome
Adam Faraj
@adamfaraj
Dec 17 2016 06:42
Can someone critique my first project?
Adam Faraj
@adamfaraj
Dec 17 2016 06:51
wait. made a few changed
changes*
Sorin Ruse
@sorinr
Dec 17 2016 06:53
@adamfaraj better now. the ul had no space at top
Adam Faraj
@adamfaraj
Dec 17 2016 06:54
wait, i changed a few more things. haha
never satisfied
dang. forgot about the "target="_blank"
ok, last time
i promise
Ashish verma
@ashish1500616
Dec 17 2016 06:59

hey any can look into my code and help me to add variable strTemp in get link in ajax

     $(document).ready(function() {
            $("#seabtn").click(function() {
                var strTemp=$("#searchfield").val();

                console.log(strTemp);
                $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=+strTemp&appid=869e6fd2f6e579ae650d308cb7f62cb4', function(str) {
                    console.log(str);
                    /*optional stuff to do after success */
                    $("#text2change").html(str.coord.lon);
                });
            });
        });

i need help.
in the url link

Sorin Ruse
@sorinr
Dec 17 2016 07:01
@bitian1506 it should be like 'http://api.openweathermap.org/data/2.5/weather?q='+strTemp+'&appid=869e6fd2f6e579ae650d308cb7f62cb4'
Ashish verma
@ashish1500616
Dec 17 2016 07:03
done
Sorin Ruse
@sorinr
Dec 17 2016 07:03
@bitian1506 welcome
Ashish verma
@ashish1500616
Dec 17 2016 07:03
@sorinr thanks
CamperBot
@camperbot
Dec 17 2016 07:03
bitian1506 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 960 | @sorinr |http://www.freecodecamp.com/sorinr
c0d0er
@c0d0er
Dec 17 2016 07:18
@0x0936 thanks
CamperBot
@camperbot
Dec 17 2016 07:18
c0d0er sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star2: 2107 | @0x0936 |http://www.freecodecamp.com/0x0936
Adam Faraj
@adamfaraj
Dec 17 2016 07:28
So I'm on Project 2: Build a Personal Portfolio Webpage
and the example has a pinned menu. i started googling on how to have a stickied menu
i glanced at the code of the example, and they have JS
CodeCamp hasn't taught me JS yet
just HTML and CSS and some JQuery
can I make a pinned menu with just HTML and CSS?
Sorin Ruse
@sorinr
Dec 17 2016 07:32
@adamfaraj yes you can: give your nav a position: fixed
Michael Bomholt
@bomholtm
Dec 17 2016 08:14
@adamfaraj fcc taught you how to use bootstrap didnt it? https://getbootstrap.com/examples/navbar-fixed-top/ bootstrap got a fixed navbar implemented
good luck with your portfolio :)
Spyrantis Theodoros
@thodorisanta
Dec 17 2016 08:39
can someone explain ".REPLACE" to me? I read about it but i still cant completely understand how it works.
for instance .replace(/[aeiou]/ig,'') i know that this removes the vowels of a string. But what exactly every "character" in there means? thank you :)
@thodorisanta
İnci Qasımova
@inci-august
Dec 17 2016 09:35
Hi, everyone. I'm trying to build weather app. I've decided on using Dark Sky API. It works but it won't display weather icon. I've checked the console. It says 'Skycons is not defined'. Can you help? Here's my code.
// Prepend https:// to codepen url in order for navigator.geolocation to work

$(document).ready(function() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      var lat = position.coords.latitude;
      var lon = position.coords.longitude;
      var url = "https://api.darksky.net/forecast/myapikey/" + lat + "," + lon;
      $.ajax({
        type: 'GET',
        url: url,
        dataType: "jsonp",
        success: function(data) {
          var country = data.timezone.replace("/", ", ");
          var dailySummary = data.daily.summary;
          var fahrenheit = Math.round(data.currently.temperature);
          var celsius = Math.round((fahrenheit - 32) * (5 / 9));
          $(".info").html("<p>" + country + "</p><p>" + dailySummary + "<canvas id='icon' width='128' height='128'></canvas>" + "</p><p class='celsius'>" + celsius + "</p><p class='fahrenheit hide'>" + fahrenheit + "</p>" + "<p class='degree'>" + "&deg;F" + "</p>");
          var skycons = new Skycons({"color": "pink"});
          var icon = data.currently.icon;
          skycons.add("icon", Skycons.icon);
          skycons.play();
        }

      });
    });
  }


});
Sorin Ruse
@sorinr
Dec 17 2016 09:43
@inci-august read this: http://darkskyapp.github.io/skycons/
Ashish verma
@ashish1500616
Dec 17 2016 09:52
hey
here is my code
i want a enter key to be as event to execute the function
        $(document).ready(function() {
            $("#seabtn").keypress(function(e) 
            {
                var key=e.which;
                if(key == 13){
                var strTemp = $("#searchfield").val();

                console.log(strTemp);
                $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=' + strTemp + '&appid=869e6fd2f6e579ae650d308cb7f62cb4', function(str) {
                    console.log(str);
                    /*optional stuff to do after success */
                    $("#text2change").html("LOCATION:" + str.name + "</br>" + "Latitude:" + str.coord.lat + "</br>" + "Longitude:" + str.coord.lon + "</br>" + "TEMP:" + str.main.temp + "</br>" + "PRESSURE:" + str.main.pressure + "</br>" + "MIN TEMP:" + str.main.temp_min + "</br>" + "MAX TEMP:" + str.main.temp_max + "</br>");
                });
            }
            });
        });
İnci Qasımova
@inci-august
Dec 17 2016 10:04
Hi @sorinr . I've read it already. That's how I tried to add icons to my app. I added canvas tags, gave it an id, and used that id to add icons. For some reason it won't work.
Sorin Ruse
@sorinr
Dec 17 2016 10:08
@inci-august can you console.log(icon) after var icon = data.currently.icon; and let me know what you get? or just share the pen link if you have it on codepen
İnci Qasımova
@inci-august
Dec 17 2016 10:12
@sorinr sure. Here's my pen
https://codepen.io/inci_august/pen/pNZJrM
@sorinr I tried to console.log. But it doesn't seem to be returning anything.
Sorin Ruse
@sorinr
Dec 17 2016 10:15
@inci-august it seems your problem start from var skycons = new Skycons({"color": "pink"}); Skycons its not recognized as an object to declare it like that
İnci Qasımova
@inci-august
Dec 17 2016 10:18
@sorinr I agree. I tried to add a script tag to my html page and use js file that declares skycons object from their github page. It didn't work either.
@sorinr thanks by the way. I guess I'll try something else.
CamperBot
@camperbot
Dec 17 2016 10:22
inci-august sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 963 | @sorinr |http://www.freecodecamp.com/sorinr
Josaped Moreno
@androuino
Dec 17 2016 10:40
hello guys, what do you think about my Wikipedia Viewer?
http://codepen.io/shaolin30/full/ZBrqJJ/
thanks in advance for the feedback.
Robert Purcea
@RobertPurcea
Dec 17 2016 10:52
@androuino where should I click for a random article?
Cause "here" doesn't work :)
Josaped Moreno
@androuino
Dec 17 2016 11:01
Just followed the example. Didn't realized that. 😂
@Robertb4
Mahak Narayan Singh
@makkBit
Dec 17 2016 11:04
@androuino nice ui :+1: just fix the click for a random article. Also it would be better if u some sanity check. Like if no article is found for a particular search query from the api, display the message stating so.
Josaped Moreno
@androuino
Dec 17 2016 11:06
Thanks Mahak, I'll surely add that functionality.
Mahak Narayan Singh
@makkBit
Dec 17 2016 11:10
It would be ALSO better if you had used my username instead of my name lol :smile:
Josaped Moreno
@androuino
Dec 17 2016 11:11
Haha, can't see ur username. I'm using the android gitter app.
That's why I cannot tag your username with my replies.
Adi2Point0
@Adi2Point0
Dec 17 2016 11:12
He's just hunting for brownies ;)
Josaped Moreno
@androuino
Dec 17 2016 11:12
Yes he did.
Mahak Narayan Singh
@makkBit
Dec 17 2016 11:17
thats how it works @Adi2Point0
@androuino well u can. but i won't explain how. otherwise u guyz will call be brownie obsessed.
Adi2Point0
@Adi2Point0
Dec 17 2016 11:23
brownie fetish ;)
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 11:28
I have code fetish :p
Mahak Narayan Singh
@makkBit
Dec 17 2016 11:30
hahha good 1 @Adi2Point0
Fabio Di Pane
@saylos
Dec 17 2016 11:48
@JLuboff @sorinr thanks. location var will be the name of the city + country, obtained from an other api (since I understood that it's not possible to use the navigator.geolocation with codepen).
CamperBot
@camperbot
Dec 17 2016 11:48
saylos sends brownie points to @jluboff and @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 496 | @jluboff |http://www.freecodecamp.com/jluboff
:cookie: 964 | @sorinr |http://www.freecodecamp.com/sorinr
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 11:53
so.... could some would give a twitch channel which always online ??
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 12:21
ahhh..... my internet connection is so darn slow .... even a push of a small commit to github fails :,-)
ahhh..... my internet connection is so darn slow .... even a push of a small commit to github fails :,)
Fabio Di Pane
@saylos
Dec 17 2016 12:23
Hi guys, I can't figure out why this script doesn't work (the part regarding the weather api):
$(document).ready(function(){

  var location;

  $.getJSON("http://ip-api.com/json", function(json){

    location = json.city;
    var country = json.country;
    $("#Location").html("<p>"+location+", "+country+"</p>");

  });

  $.getJSON("http://api.openweathermap.org/data/2.5/weather?q="+location, function(json){

    $("#Weather").html("<p>"+json.description+"</p>");

  });

});
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:28
@saylos code looks ok. codepen link plz.
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:30
@Mr-Kumar-Abhishek jio nahi liya bhai? :smile:
Sorin Ruse
@sorinr
Dec 17 2016 12:30
@saylos think you need the api key for the weather
Fabio Di Pane
@saylos
Dec 17 2016 12:30
where do I find it?
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 12:31
@makBit jio doesn't work everywhere , and absolutely not in this forsaken place ~
digital nomad life ~
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:32
@saylos got the problem.
$(document).ready(function(){

  var location;


  $.getJSON("http://ip-api.com/json", function(json){

    location = json.city;
     $.getJSON("http://api.openweathermap.org/data/2.5/weather?q="+location, function(json){

    $("#Weather").html("<p>"+json.description+"</p>");

  });
    console.log(location);
    var country = json.country;
    $("#Location").html("<p>"+location+", "+country+"</p>");

  });





});
Sorin Ruse
@sorinr
Dec 17 2016 12:32
@saylos register to the api its free
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:33
$getJSON('http://api.open....') should be inside the callback function of $.getJSON('http://ip-api); @saylos
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:35
because u were trying to use country variable in weather api query before its getting defined in ip address api callback function.
@saylos
Mark
@markolie20
Dec 17 2016 12:36
hey guys im a bit new and i have need to make a portfolio with buttons that automaticaly scroll for you but i dont have a clue on how to do that can someone pls help
Sorin Ruse
@sorinr
Dec 17 2016 12:36
@markolie20 just google it for in page linking
Fabio Di Pane
@saylos
Dec 17 2016 12:37
@makkBit @sorinr ok thanks guys, I'll see if I can handle it from now on. First i'll try to understand what's a callback function :smile:
CamperBot
@camperbot
Dec 17 2016 12:37
:cookie: 363 | @makkbit |http://www.freecodecamp.com/makkbit
:warning: saylos already gave sorinr points
saylos sends brownie points to @makkbit and @sorinr :sparkles: :thumbsup: :sparkles:
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:38
https://medium.freecodecamp.com/understanding-asynchronous-javascript-callbacks-through-household-chores-e3de9a1dbd04
read this. this article explains callbacks in simple and very understanding way .
Fabio Di Pane
@saylos
Dec 17 2016 12:39
@makkBit great :+1:
Ayobami
@purpose50
Dec 17 2016 12:45

can you please help with this:
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
my code is not passing any test
here is the code:

```function destroyer(arr) {
// Remove all the values
var newArr = arr.filter(function(val) {
for(i = 1; i < arguments.length; i++) {
return val !== arguments[i];
}
});

return newArr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
```
the test
destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
destroyer([2, 3, 2, 3], 2, 3) should return [].
destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].

can you please help with this:
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
my code is not passing any test
here is the code:

```function destroyer(arr) {
// Remove all the values
var newArr = arr.filter(function(val) {
for(i = 1; i < arguments.length; i++) {
return val !== arguments[i];
}
});

return newArr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
```
the test
destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
destroyer([2, 3, 2, 3], 2, 3) should return [].
destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].

Mahak Narayan Singh
@makkBit
Dec 17 2016 12:45
@Mr-Kumar-Abhishek well then invest in high speed internet. u truly need for web dev. jio works for me though, around 500kb/sec :smile:
Ayobami
@purpose50
Dec 17 2016 12:46

can you please help with this:
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
my code is not passing any test
here is the code:

function destroyer(arr) {
  // Remove all the values
  var newArr = arr.filter(function(val) {
    for(i = 1; i < arguments.length; i++) {
      return val !== arguments[i];
    }
  });

  return newArr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

the test
destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
destroyer([2, 3, 2, 3], 2, 3) should return [].
destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].

Mahak Narayan Singh
@makkBit
Dec 17 2016 12:48
@purpose50
You need to work with arguments as if it was a regular array. The best way is to convert it into one.
You need to filter, this also means you need to create a callback function, one that checks if the element is on the indexOf()
To convert arguments into an array use this code var args = Array.prototype.slice.call(arguments);
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 12:48
@makkBit I did "invest" in high speed internet ... unlimited 3G of BSNL (highest coverage ) , but apparently not that great ~
Ayobami
@purpose50
Dec 17 2016 12:48
@makkBit okay will try that now
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 12:49
@makkBit I wonder matrix sim cards have better internet ~
Mahak Narayan Singh
@makkBit
Dec 17 2016 12:53
@Mr-Kumar-Abhishek I have heard matrix sim cards are good for tourists only
Nitin Chandran Nair
@NitinNair89
Dec 17 2016 12:54
Hello World! :)
CamperBot
@camperbot
Dec 17 2016 12:54

welcome to FreeCodeCamp @NitinNair89!

diederikquak
@diederikquak
Dec 17 2016 12:54
why does this code makes two buttons instead of one?
  <button onClick="searchForArticle" class="fa fa-search fa-lg" aria-hidden="true">search<button>
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 12:54
@makkBit yup, that's why I am asking ~
digital nomad life ~
Nitin Chandran Nair
@NitinNair89
Dec 17 2016 12:54
@diederikquak your button tag is not closed properly
it should be </button>
diederikquak
@diederikquak
Dec 17 2016 12:55
o wow thx @NitinNair89 :worried:
CamperBot
@camperbot
Dec 17 2016 12:55
diederikquak sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 365 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
Nitin Chandran Nair
@NitinNair89
Dec 17 2016 12:55
Happy to assist :)
shreyas23sk
@shreyas23sk
Dec 17 2016 12:57
can somebody explain to me why that upid piece of text refuses to display on my screen?
https://codepen.io/shreyas23-sk/pen/ENGgmX
The one below the navbar
Ashan Mohammed
@AshanMohammed
Dec 17 2016 12:58
Hello! how to fix the image caption inside the bootstrap thumbnail
Nitin Chandran Nair
@NitinNair89
Dec 17 2016 12:58
@shreyas23sk That's because your "text" is beneath the navbar
add some margin-top to the row with the text
<div class = "row" style="margin-top:50px;">
ks-mai
@ks-mai
Dec 17 2016 13:06

$.ajax({
'url': '//en.wikipedia.org/w/api.php',
'dataType': 'jsonp',
'data': {
'action': 'opensearch',
'search': encodeURIComponent($('.search-input').val()),
'limit': 'max',
'namespace' : '0',
'format': 'json',
'success': function(data) {
console.log(data);
},
'error': function() {

    }
  }
}); 

// in browser's developer tools i can see the JSON response received, but console.log(data) is giving me undefined. How is this the case?

Joel
@okmarq
Dec 17 2016 13:14
how do i tweet my quote without having to refresh the codepen
Ayobami
@purpose50
Dec 17 2016 13:18
@makkBit man! thank you so much, your suggestion worked :+1: , although i stillhad to do some thinking before i could get it, thanks for the tip :smile:
CamperBot
@camperbot
Dec 17 2016 13:18
purpose50 sends brownie points to @makkbit :sparkles: :thumbsup: :sparkles:
:cookie: 364 | @makkbit |http://www.freecodecamp.com/makkbit
Mahak Narayan Singh
@makkBit
Dec 17 2016 13:24
@purpose50 cheers !! :smile:
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 13:27
could some one help me why this not working https://github.com/Mr-Kumar-Abhishek/observe-twitch-tv/blob/test/js/main.js , I am not able to append
Jean Marco Romero
@volkranium
Dec 17 2016 13:52
@DennisTalmid hahaha wow , ive used that a lot , but never thought about using it in a picture to create that effect... Thanks again Dennis
CamperBot
@camperbot
Dec 17 2016 13:52
volkranium sends brownie points to @dennistalmid :sparkles: :thumbsup: :sparkles:
:cookie: 129 | @dennistalmid |http://www.freecodecamp.com/dennistalmid
Patrick Akpala
@kemaakpala
Dec 17 2016 13:57
Hi guys i'm having issues with my portfolio page in mobile view. for some reason the navigation doesn't seem to work even though i've included the bootstrap js and jquery . here is the link to my portfolio page. https://codepen.io/pakpala/full/WoLxOa/.
BobbaWoolf
@BobbaWoolf
Dec 17 2016 14:13
how do i make a text like this?>
woutswennen
@woutswennen
Dec 17 2016 14:31
How to use framework
Uros Tadic
@urketadic
Dec 17 2016 14:34
yo guys why isnt this working for numbers but only for letters, like keyCode isnt wokring for code === 51 (3) 3 still gets typed in and not replaced by 1.
function transformTypedCharacter(typedChar) {
         var code = typedChar.keyCode;
     if(typedChar == "a") {
       return typedChar = "b";
     }
     else if(typedChar == "q") {
      return typedChar = 7;
     }
     else if(typedChar == "b") {
         return typedChar = 9;
     }
     else if(code === 51) {
      typedChar.preventDefault();
         return typedChar = 1;
     }
     else {
      return typedChar;
     }

}
Jean Marco Romero
@volkranium
Dec 17 2016 14:43
Hey supp fellow coders
Is it bad practice to use big margins? like margin-right: 500px;
Uros Tadic
@urketadic
Dec 17 2016 14:47
Yes :D
Its probably going to mess things up when you view it on different sized
monitor
Jean Marco Romero
@volkranium
Dec 17 2016 14:53
@urketadic hmm , and what would be a good option to seperate a nav bar from a logo
with inline-block method
Uros Tadic
@urketadic
Dec 17 2016 14:56
like, you can probably use margin but then you should use media queries to set up website for each resolution
but yes i dont know how the website looks
idk whats the best
Jean Marco Romero
@volkranium
Dec 17 2016 14:57
@urketadic havent done it its just something i find myself doing xD
BobbaWoolf
@BobbaWoolf
Dec 17 2016 14:57
anybody know how to make my text like this?https://gyazo.com/e8ddaa988a8e481f5c36dc8be0dc7b10
Jean Marco Romero
@volkranium
Dec 17 2016 14:57
@urketadic adding huge right margin to the logo to separate the nav bar
Uros Tadic
@urketadic
Dec 17 2016 15:07
like
is floating it to the other side going to work
or giving it position and then like right: 2px;
Callum Ward
@callumquick
Dec 17 2016 15:13
@BobbaWoolf Probably a font
Karen McCulloch
@kazzacarrot
Dec 17 2016 15:22
@BobbaWoolf check out https://fonts.google.com/
BobbaWoolf
@BobbaWoolf
Dec 17 2016 15:23
Ah! @callumquick @kazzacarrot thx guys!
CamperBot
@camperbot
Dec 17 2016 15:23
:cookie: 392 | @kazzacarrot |http://www.freecodecamp.com/kazzacarrot
bobbawoolf sends brownie points to @callumquick and @kazzacarrot :sparkles: :thumbsup: :sparkles:
:cookie: 312 | @callumquick |http://www.freecodecamp.com/callumquick
Waqas Abbasi
@Waqas909
Dec 17 2016 15:23
@moT01 Yea the keyup part is good Thanks! However, I need to find someway of matching the letters typed in the search box with the channel names :/ I'm stuck on that now
CamperBot
@camperbot
Dec 17 2016 15:23
waqas909 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 416 | @mot01 |http://www.freecodecamp.com/mot01
Pankaj Singh
@aa3pankaj
Dec 17 2016 16:03

hii.. can anybody plzz help me with my portfolio project....
code: <div style="position:fixed; background:silver; width:100%">

<div class="row">
<div class="col-xs-4 "> <button id="button1" class="btn btn-block btn-primary">About</button></div>

<div class="col-xs-4 "> <button id="button1" class="btn btn-block btn-primary">Portfolio</button></div>

<div class="col-xs-4 "> <button id="button1" class="btn btn-block btn-primary">Contact</button></div>
</div>

Callum Ward
@callumquick
Dec 17 2016 16:17
@aa3pankaj What do you need help with?
RakeshNerkar
@Rakesh18754
Dec 17 2016 16:26

var arr1 = [2,3,4, 5, 6,4, 7];
var arr2 = [2,3];

i want to write a function that will fetch every element from arr1 and then check if that element is present in arr2 if present it should return true

so in this case it should return true two times as both elements are present in arr1.

Callum Ward
@callumquick
Dec 17 2016 16:34
@Rakesh18754 Do a for each element in arr1, do something for each element in arr2
RakeshNerkar
@Rakesh18754
Dec 17 2016 16:36

@callumquick
i tried

var arr1 = [2,3,4,5,6,4,7];
var arr2 = [2,3];
for(var i = 0; i < arr1.length; i++) {
                                    for(var k = i + 1; k < arr2.length; k++) {
                        console.log(arr1[i].includes(arr2[k]));
                                        arr1.includes(arr2);
                                    }
                                }

but got this error

Uncaught TypeError: arr1[i].includes is not a function
@callumquick any help on this as i am new to js
Tyler Moeller
@TylerMoeller
Dec 17 2016 16:39
@Rakesh18754 This should help you out with some hints on getting started: https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Algorithm-Diff-Two-Arrays
Henz
@pilotwhiterabbit
Dec 17 2016 16:51
Hi. I'm inserting a new section with a background image but it doesn't go at the bottom of the page. Instead, it becomes a background of the previous section. Any ideas? http://codepen.io/pilotwhiterabbit/pen/RoErqO
Robert
@Quadrob
Dec 17 2016 16:54
Hey please could someone help me with task 146(escape sequence in strings) i have been stuck most of the day
Nguyen Thanh An
@RoastedChicken
Dec 17 2016 16:57
Hi. I'm doing the challenge: Build a Random Quote Machine. Where i can find the source quote ?
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 17:00
@RoastedChicken make your own source code
Apoorv Mishra
@apoorv-mishra
Dec 17 2016 17:01
Hi, I stumbled upon this snippet while searching <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i> </button> can anyone explain me in the snipped what does this "collapsed" class do. I searched a lot but couldn't find this class. I could find the class "collapse" and related classed but couldn't find "collapsed". Is it a typo or am I missing something. Please help!
Nguyen Thanh An
@RoastedChicken
Dec 17 2016 17:02
It's mean i use google to copy many quotes to make source quote ?
Apoorv Mishra
@apoorv-mishra
Dec 17 2016 17:05

@Mr-Kumar-Abhishek Hi, I stumbled upon this snippet while searching ```

<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
</button>``` can anyone explain me in the snipped what does this "collapsed" class do. I searched a lot but couldn't find this class. I could find the class "collapse" and related classed but couldn't find "collapsed". Is it a typo or am I missing something. Please help!

Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 17:06
@RoastedChicken use API to get random quotes google "quotes API"
@RoastedChicken look here is an good API --> https://quotesondesign.com/api-v4-0/
:)
Nguyen Thanh An
@RoastedChicken
Dec 17 2016 17:09
thanks @Mr-Kumar-Abhishek
CamperBot
@camperbot
Dec 17 2016 17:09
roastedchicken sends brownie points to @mr-kumar-abhishek :sparkles: :thumbsup: :sparkles:
:cookie: 454 | @mr-kumar-abhishek |http://www.freecodecamp.com/mr-kumar-abhishek
casadin
@casadin
Dec 17 2016 17:23
Hi, can somebody tell me why I have this white strip between navigation bar and my background image? And how to delete this? http://codepen.io/casadin/pen/ZBVmpw?editors=1100
GastroGeek
@GastroGeek
Dec 17 2016 17:31
@casadin - i dont see a white strip? make sure you are not 'zoomed' on your browser... sometimes causes strangeness... looks OK for me in Chrome, Firefox and Opera on OSX.
Apoorv Mishra
@apoorv-mishra
Dec 17 2016 17:39
Hi, need help!
I stumbled upon this snippet while searching <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i> </button> can anyone explain me in the snippet what does this "collapsed" class do. I searched a lot but couldn't find this class. I could find the class "collapse" and related classed but couldn't find "collapsed". Is it a typo or am I missing something?Please help!
Ayobami
@purpose50
Dec 17 2016 17:47

hi guys
any help with this please
One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount.
A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.
Write a function which takes a ROT13 encoded string as input and returns a decoded string.
All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.
here is my code:

function rot13(str) { // LBH QVQ VG!
  var newStr = "";
  for(i = 0; i < str.length; i++) {
    var strVal = str[0];
    if(strVal !== " ") {
      var charValue = str.charCodeAt(i);
      charValue-=13;
      var fCharValue = String.fromCharCode(charValue);
      newStr+=fCharValue;
    }else {
      newStr+= " ";
    }
  }
  return newStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
the test that should be passed:
rot13("SERR PBQR PNZC") should decode to "FREE CODE CAMP"
rot13("SERR CVMMN!") should decode to "FREE PIZZA!"
rot13("SERR YBIR?") should decode to "FREE LOVE?"
rot13("GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.") should decode to "THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX."
what i got for the first test:
F8EE C5DE CAM6
please what am i doing wrong and what should i do?
_

casadin
@casadin
Dec 17 2016 17:52
@GastroGeek i fixed it already :) thanks
CamperBot
@camperbot
Dec 17 2016 17:52
casadin sends brownie points to @gastrogeek :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for gastrogeek
Apoorv Mishra
@apoorv-mishra
Dec 17 2016 17:53
@NitinNair89 Sorry, but I couldn't find what I was looking for. Thanks, by the way :)
CamperBot
@camperbot
Dec 17 2016 17:53
apoorv-mishra sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 17:57
@purpose50 this is not a javascript chatroom but..... you don't have to get the char codes as such ... also the maths in the algo is wrong ~
@purpose50 this is not a javascript chatroom but..... you don't have to get the char codes as such ... also the maths in the algorithm is wrong ... ~
Ayobami
@purpose50
Dec 17 2016 17:58
@Mr-Kumar-Abhishek just frustrated since i've been stuck with these for hours
@Mr-Kumar-Abhishek thanks anyways :+1:
CamperBot
@camperbot
Dec 17 2016 17:59
purpose50 sends brownie points to @mr-kumar-abhishek :sparkles: :thumbsup: :sparkles:
:cookie: 455 | @mr-kumar-abhishek |http://www.freecodecamp.com/mr-kumar-abhishek
Uros Tadic
@urketadic
Dec 17 2016 18:02
if(code == 51) { //If 3
        ev.preventDefault();
        var inputNumber = "1";  //then 1
        adder (inputNumber);
        placeCaretAtEnd(this);
        last.remove();
      }
      else if(code == 52) { //If 4
        var inputNumber = "2"; //then 2
        adder (inputNumber);
        placeCaretAtEnd(this);
      }
      else if (code == 53) { //If 5
        var inputNumber = "3"; //then 3
        adder (inputNumber);
        placeCaretAtEnd(this);
I have a problem, and no it cant be solved with ev.preventDefault();
When i write 3, it will write both 3 and 1. I want it only to write 3. I don't know how to prevent it.
There is other part of my code that is responsible for outputing these numbers that i am overriding now. Thats why it is writting both numbers. Dont know how to prevent it though.
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 18:13
@urketadic declare the variable inputNumber outside the scope of if - else statements. ~
@urketadic and define them inside the scope of if-else statements
Uros Tadic
@urketadic
Dec 17 2016 18:16
its already defined outside
@Mr-Kumar-Abhishek btw look at http://codepen.io/urketadic/pen/oYJJEq?editors=0011
its at line 119
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 18:16
@urketadic do I have to write the code ?? okay
Uros Tadic
@urketadic
Dec 17 2016 18:17
Well it would be awesome if you could fix it
my frined will be able to start learning PI for World Record then, finaly :D
il try something myself
vengal
@vengal4327
Dec 17 2016 18:18
I'm using CSS table to align header elements. Is it possible to wrap inner divs to it's content size and also align them to left, center and right respectively? http://codepen.io/vengal-learn/pen/QGJdze
Uros Tadic
@urketadic
Dec 17 2016 18:18
@Mr-Kumar-Abhishek Some guy helped me fix it
Diego
problem was, last was defined outside of reach
i was trying to reach for a command outside of my scope
:/
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 18:19
@urketadic ouch such a heavy website ~ ... it will break my flimsy computer ... so you got the solution then ?
@urketadic as I said before lol
Uros Tadic
@urketadic
Dec 17 2016 18:20
Yep
Waqas Abbasi
@Waqas909
Dec 17 2016 18:20
any other way of getting ajax requests inside a for loop, other than async: false (Freezes the browser)?
Uros Tadic
@urketadic
Dec 17 2016 18:20
I can make code cleaner now when everything is working
vengal
@vengal4327
Dec 17 2016 18:24
@Mr-Kumar-Abhishek Can you help me with this: I'm using CSS table to align header elements. Is it possible to wrap inner divs to it's content size and also align them to left, center and right respectively? http://codepen.io/vengal-learn/pen/QGJdze
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 18:28
@vengal14327 there is no such thing as float: center; .... and yes there is a way to adjust them the way you want but it will not be done through textalign
@vengal14327 there is float left , float right and float clear..
@vengal14327 once a html tag has float (left or right ) it will effect all the lower html tags , whether it is a child tag or not
@vengal14327 to clear its effects , we either use something like <div class='clearfix'></div> or add a division whose class is having float: clear;
Sorin Ruse
@sorinr
Dec 17 2016 18:31
@vengal4327 i would just use flexbox
Abhishek Kumar
@Mr-Kumar-Abhishek
Dec 17 2016 18:32
@vengal14327 yes flexbox is a better choice
@vengal14327 however see here .. if you want to continue on the track what you choosen https://developer.mozilla.org/en/docs/Web/CSS/float
@vengal14327 also it should be clear: both; I forgot :p
@vengal14327 my apologies.... flexbox is way better ~
vengal
@vengal4327
Dec 17 2016 18:49
I cant use flexbox that one is opted out. That's why i'm trying this alternative
Sorin Ruse
@sorinr
Dec 17 2016 18:53
@vengal4327 why?
Tyler Moeller
@TylerMoeller
Dec 17 2016 18:53
@vengal4327 Is bootstrap an option? https://getbootstrap.com/components/#navbar-default
vengal
@vengal4327
Dec 17 2016 18:54
Mine should support only IE8 so i cant use that
BobbaWoolf
@BobbaWoolf
Dec 17 2016 18:54
https://gyazo.com/71630b7dc2ee306f20a422da964fa528 I've put a <hr> sign over the picture but It doesn't show can anyone help me with that?
vengal
@vengal4327
Dec 17 2016 18:54
Yes i can use boot strap
Tyler Moeller
@TylerMoeller
Dec 17 2016 18:54
Yeah, it's hard to support IE8 with flexbox, here's a quick example with bootstrap: http://codepen.io/TylerMoeller/pen/mOavRb?editors=1000
To give an idea, lots of ways to customize it without much additional effort
playingwithinfinity
@playingwithinfinity
Dec 17 2016 19:09
@TylerMoeller Thanks!
CamperBot
@camperbot
Dec 17 2016 19:09
playingwithinfinity sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1166 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Dec 17 2016 19:10
You're welcome? :) Don't know what I helped with.
@BobbaWoolf I don't see a picture in that screenshot you sent. Do you have a codepen showing the problem?
Matus
@Matorp
Dec 17 2016 19:11

<style>
.text-center {
text-align: center
}
</style>

<div class="container-fluid">
<h2 class="red-text" "text-center">CatPhotoApp</h2>
</div>

why its not working?
playingwithinfinity
@playingwithinfinity
Dec 17 2016 19:11
@TylerMoeller Yesterday night.
vengal
@vengal4327
Dec 17 2016 19:13
I will try that and let you know if its working. Thanks!! @TylerMoeller
CamperBot
@camperbot
Dec 17 2016 19:13
vengal4327 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1167 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Sorin Ruse
@sorinr
Dec 17 2016 19:13
@Matorp maybe something here: class="red-text" "text-center"
Matus
@Matorp
Dec 17 2016 19:14
@sorinr - red text is OK, I just deleted it from preview
Sorin Ruse
@sorinr
Dec 17 2016 19:14
@Matorp class="class1 class2 class3 etc"
Matus
@Matorp
Dec 17 2016 19:16

text-center is not working

that was it. thanks

Sorin Ruse
@sorinr
Dec 17 2016 19:19
@Matorp the idea was not to have class="red-text" "text-center" but class="red-text text-center" the classes r not supposed to be separated by " but by space
Chris
@cli53
Dec 17 2016 19:25
Hi! I was wondering how to push my nav bar on the left side and stop the squishing of my block elements: http://codepen.io/cli53/pen/ZBVwRo
Sorin Ruse
@sorinr
Dec 17 2016 19:34

@cli53 you can try:

nav ul{
  text-align: left;
}

if this is what u want

Chris
@cli53
Dec 17 2016 19:37
it worked great! I was just confused how come it doesn't work when added to the nav li
I would like to know more in depth about where to add properties and values when it comes to list because it just ends up to be a guessing game for me
Sorin Ruse
@sorinr
Dec 17 2016 19:40
@cli53 when it comes to styling and placing elements on a page just look for css. css-triks.com is a good place to look at
Chris
@cli53
Dec 17 2016 19:46
Thank you!
Sorin Ruse
@sorinr
Dec 17 2016 19:46
@cli53 welcome
BobbaWoolf
@BobbaWoolf
Dec 17 2016 19:50

<ul>

<li><a class="active" href="#home">Home</a></li>

<li class="active"><a href="#About"><span>About</span></a>
<li><a href="#Pictures">Pictures</a></li>
<li><a href="#Contact">Contact</a></li>
</ul> My navigation bar isn't working

can anyone help?
Sorin Ruse
@sorinr
Dec 17 2016 19:52
@BobbaWoolf i see its working. u mean in page navigation?
Jichoat
@Jichoat
Dec 17 2016 19:54
Anyone know how to add empty containers to your website? I am trying to test the spacing and placement of my elements, I can't seem to just make 'empty' space ._.
Igor Amidzic
@igoramidzic
Dec 17 2016 19:55
@Jichoat You can create a div in your html, and style it in css with height and width of your choosing
Sorin Ruse
@sorinr
Dec 17 2016 19:56
@BobbaWoolf first u have two li tags that has the class "active". active class means usually the current link last clicked. to make an in page navigation you will need also some corresponding sections (div, section, whatever) that must have the id="home", or the id="About", etc
Jichoat
@Jichoat
Dec 17 2016 19:57
@amidzicigor That's what I did (http://codepen.io/Jicho/full/ZBVwmj/) but its not showing anything unless there is text in the field. Unless I am screwing something up.
Sorin Ruse
@sorinr
Dec 17 2016 19:57
@Jichoat if you want to use bootstrap just look for offset in their grid docs
Jichoat
@Jichoat
Dec 17 2016 19:58
@sorinr So break it up into rows and cols with bootstrap first?
Igor Amidzic
@igoramidzic
Dec 17 2016 19:59
@Jichoat When you create a div, the natural height is 0. The div only expands once there is content inside of it.
In your css, target the div you want to see and give it a style of
background-color: orange
height: 50px
Sorin Ruse
@sorinr
Dec 17 2016 19:59
@Jichoat oh. that is just normal. if an element has height 0 will not be visible. if u add in css: element {min-height: 600px; background: red} u will see it even if you don't have any elements inside of it
Jichoat
@Jichoat
Dec 17 2016 20:00
@amidzicigor oh gotcha I see now I was using max-height and max-width Thanks Igor!!
CamperBot
@camperbot
Dec 17 2016 20:00
jichoat sends brownie points to @amidzicigor :sparkles: :thumbsup: :sparkles:
:cookie: 58 | @amidzicigor |http://www.freecodecamp.com/amidzicigor
Igor Amidzic
@igoramidzic
Dec 17 2016 20:00
@Jichoat No problem :)
Sorin Ruse
@sorinr
Dec 17 2016 20:00
@Jichoat yep. read this: http://getbootstrap.com/css/#grid
Jichoat
@Jichoat
Dec 17 2016 20:01
@sorinr I see now, max width and height don't work they way I thought they did x.x which was part of my problem haha...Thanks :)
@sorinr Thank you Sorin!! :D
CamperBot
@camperbot
Dec 17 2016 20:02
jichoat sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 966 | @sorinr |http://www.freecodecamp.com/sorinr
Igor Amidzic
@igoramidzic
Dec 17 2016 20:02
@Jichoat Let me know if you need any more help with boostrap. I'm learning right now myself
Jichoat
@Jichoat
Dec 17 2016 20:03
@amidzicigor For sure!! I am working on my 'portfolio' project, and trying to lay everything out first. Since I don't have anything for it yet
Igor Amidzic
@igoramidzic
Dec 17 2016 20:03
@Jichoat Haha true.. I'm at that step right now. I'm starting my portfolio, but have no content lol www.codewithigor.com
BobbaWoolf
@BobbaWoolf
Dec 17 2016 20:05
@sorinr yes page navigation Ok so you mean I need to make them active and have a div class with the id ="home" etc? yes?
Jichoat
@Jichoat
Dec 17 2016 20:06
@amidzicigor Looks really good so far; more than what I have haha. If you are interested in adding some color to your page; you should take a look at http://paletton.com. It's great to create color pallets, it also provides a preview of the colors and hex codes
Sorin Ruse
@sorinr
Dec 17 2016 20:06
@BobbaWoolf active class is optional. only if u want to show where the user cliked
Igor Amidzic
@igoramidzic
Dec 17 2016 20:07
@Jichoat Oh yeah I used this website before. I completely forgot about it, though. Thanks :)
CamperBot
@camperbot
Dec 17 2016 20:07
amidzicigor sends brownie points to @jichoat :sparkles: :thumbsup: :sparkles:
:cookie: 118 | @jichoat |http://www.freecodecamp.com/jichoat
BobbaWoolf
@BobbaWoolf
Dec 17 2016 20:07
@sorinr Ah ok thank you so much for the help!
CamperBot
@camperbot
Dec 17 2016 20:07
bobbawoolf sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 967 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Dec 17 2016 20:07
@BobbaWoolf but yes you need some divs having a corresponding id as your links
Jichoat
@Jichoat
Dec 17 2016 20:07
@amidzicigor You're welcome :D
Sorin Ruse
@sorinr
Dec 17 2016 20:08
@BobbaWoolf welcome
BobbaWoolf
@BobbaWoolf
Dec 17 2016 20:10

@sorinr <ul>
<div id="Home">
<div id="About">
<div id="Pictures">
<div id="Contact">
<li><a class="active" href="#home">Home</a></li>

<li class="active"><a href="#About">About</a>
<li class="active"><a href="#Pictures">Pictures</a></li>
<li class="active"><a href="#Contact">Contact</a></li>
</ul>
</div>
</div>
</div>
</div> I've done what you said still not working :/ I want it to. Take me to the place I click on the page if you know what i mean

Sorin Ruse
@sorinr
Dec 17 2016 20:12
@BobbaWoolf just a sec and i'll show you
Apoorv Mishra
@apoorv-mishra
Dec 17 2016 20:21
Hi, I found this code while searching
html
oops
Sorin Ruse
@sorinr
Dec 17 2016 20:22
@BobbaWoolf here a quick example
Apoorv Mishra
@apoorv-mishra
Dec 17 2016 20:25

Hi, I found this code while searching

<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
                </button>

I wanted to know what's the use of collapsed in class="navbar-toggle collapsed". I searched and found the class collapse, but couldn't find anything about collapsed. Am I missing something or it is just a typo? Please help!

BobbaWoolf
@BobbaWoolf
Dec 17 2016 20:31
@sorinr dang thx bro!
CamperBot
@camperbot
Dec 17 2016 20:31
bobbawoolf sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: bobbawoolf already gave sorinr points
Sorin Ruse
@sorinr
Dec 17 2016 20:32
@BobbaWoolf welcome
diederikquak
@diederikquak
Dec 17 2016 20:33

why does my code open a new window with the same url as the url of the code?
my html:

<a href="#" target="blank"><button onClick="randomArticle()" id  id="link">Click here for a random article</a>

and javascript:

function randomArticle() {
  var a = document.getElementById("link");
  a.target = "blank";
  a.href = "https://en.wikipedia.org/wiki/Special:Random";
}
Sorin Ruse
@sorinr
Dec 17 2016 20:35
@diederikquak you target the id="link" but you have it to your button element not the a tag
diederikquak
@diederikquak
Dec 17 2016 20:37
thx @sorinr but code still doing weird
CamperBot
@camperbot
Dec 17 2016 20:37
:cookie: 968 | @sorinr |http://www.freecodecamp.com/sorinr
diederikquak sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
Sorin Ruse
@sorinr
Dec 17 2016 20:37
@diederikquak aand its a mess to wrapp a button whithin an a element
Nicolas Muniz
@nicolasmuniz7
Dec 17 2016 20:38
Hello
I am currently trying to do the Local Weather App challenge...
but i'm getting problems with the api response...anybody can help me ?
Sorin Ruse
@sorinr
Dec 17 2016 20:39
@diederikquak <a href="javascript:void(0)" id="link" class="btn btn-default" onclick="randomArticle()">Click here</a>
Tyler Moeller
@TylerMoeller
Dec 17 2016 20:42
^^ much better. You can't add a link to an URL after you click the url.
Sorin Ruse
@sorinr
Dec 17 2016 20:42
@diederikquak and in randarticle function you just call window.href...... if you want it that way.
Tyler Moeller
@TylerMoeller
Dec 17 2016 20:44
<button onClick="randomArticle()" id="link">Click here for a random article</button>
function randomArticle() {
  window.open("https://en.wikipedia.org/wiki/Special:Random");
}
diederikquak
@diederikquak
Dec 17 2016 20:44
Thx very much @sorinr , could you explain to me what the difference is between using a button as class attached to a a-element and a button in a a-element?
CamperBot
@camperbot
Dec 17 2016 20:44
diederikquak sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: diederikquak already gave sorinr points
Sorin Ruse
@sorinr
Dec 17 2016 20:44
@TylerMoeller yep. i just didn't want to change his function if he wants it
@diederikquak class="btn btn-default" its a bootstap class that helps you style an a tag like a button one
Tyler Moeller
@TylerMoeller
Dec 17 2016 20:46
I suppose this works too ;)
<button onClick="window.open('https://en.wikipedia.org/wiki/Special:Random');" id="link">Click here for a random article</button>
Best to use an anchor tag though
Sorin Ruse
@sorinr
Dec 17 2016 20:46
@TylerMoeller absolutely :)
Seth Church
@iEnder
Dec 17 2016 20:47
anyone know why flex box is putting margins under flexwrapped rows? like this http://i.imgur.com/C50FX3n.png
diederikquak
@diederikquak
Dec 17 2016 20:47
thx all:)
Sorin Ruse
@sorinr
Dec 17 2016 20:48
@diederikquak welcome
@pkmn9060 do you have flex-wrap?
Jean Marco Romero
@volkranium
Dec 17 2016 20:48
supp fellow coders
diederikquak
@diederikquak
Dec 17 2016 20:49
@nicolasmuniz7 i suggest watching codewithNick on youtube to help you out
Seth Church
@iEnder
Dec 17 2016 20:49
@sonrir nvm I figured it out apprently 30% wasnt actually 30%.
Nicolas Muniz
@nicolasmuniz7
Dec 17 2016 20:49
Thank you very much
i will try
and thats my api key
Sorin Ruse
@sorinr
Dec 17 2016 20:50
@pkmn9060 :+1:
Seth Church
@iEnder
Dec 17 2016 20:51
silly css :-T
diederikquak
@diederikquak
Dec 17 2016 20:52
@nicolasmuniz7 you want to get the latitude and longitude first right?
Nicolas Muniz
@nicolasmuniz7
Dec 17 2016 20:53
@diederikquak Yeah, but thats not the error..
@diederikquak it responds that also if i put lat and long
@diederikquak just says ERR_CONNECTION_REFUSED
Sorin Ruse
@sorinr
Dec 17 2016 20:54
@nicolasmuniz7 remove https from url and put http
Nicolas Muniz
@nicolasmuniz7
Dec 17 2016 20:54
@sorinr Ive also tried that...and throws another error
diederikquak
@diederikquak
Dec 17 2016 20:54
mine works with http
Sorin Ruse
@sorinr
Dec 17 2016 20:54
@nicolasmuniz7 mixed content
diederikquak
@diederikquak
Dec 17 2016 20:55
seems like your apikey isnt valid
Nicolas Muniz
@nicolasmuniz7
Dec 17 2016 20:55
give me a sec, sorry but i gtg.. thanks for the help and the response
maybe we can talk later
thank you very much guys
Sorin Ruse
@sorinr
Dec 17 2016 20:55
@nicolasmuniz7 r u using geolocation? geo works on https
diederikquak
@diederikquak
Dec 17 2016 20:59
is it possible to change a element to another element with javascript? I want to change a "a" element to "form" element when clicked on
Sorin Ruse
@sorinr
Dec 17 2016 21:02
@diederikquak yep. refer to the parent element and change its .html(here you can place any elements you want. even an entire page)
jayisray
@jayisray
Dec 17 2016 21:04
Can someone please help me figure out why this short JS function isn’t working?
Sorin Ruse
@sorinr
Dec 17 2016 21:05
@jayisray show the function
jayisray
@jayisray
Dec 17 2016 21:06

$(document).ready(function() {
    $("#about-nav").click(function(){
        var myIds = ["home", "about-nav", "port-nav", "contact-nav"];

        for (i=0; i<myIds.length; i++)
        {
            var string = "#" + myIds[i];

            if($(string).hasClass("active") && string !== this)
            {
                $(document).getElementById(myIds[i]).removeClass("active");
                $(this).addClass("active");
            }
        }
    });
});
@sorinr
diederikquak
@diederikquak
Dec 17 2016 21:07

refer to the parentelement with

var x = document.getElementById("link").parentElement

?

Sorin Ruse
@sorinr
Dec 17 2016 21:08
@jayisray all this just to add or remove a class from a link in the navbar?
jayisray
@jayisray
Dec 17 2016 21:08
yea lol
i only want one active at a time
plus it only took me like a minute to write so no big deal
@sorinr do you have an idea why it’s not working though?
diederikquak
@diederikquak
Dec 17 2016 21:10
@sorinr nvm found a solution which uses .innerHTML on the web
Sorin Ruse
@sorinr
Dec 17 2016 21:10
@jayisray just $('a').removeClass("active") and then $(this).addClass("active")
jayisray
@jayisray
Dec 17 2016 21:10
@sorinr I did that initially, but what if someone wants to go in a random order?
@sorinr If I do that, then they have to go in the preset order for it to work
Sorin Ruse
@sorinr
Dec 17 2016 21:11
@diederikquak inner is for vanilla js and its ok
@jayisray the code above will clear the active class from any a tag then add it to the current one no matter wich one is the current clicked
jayisray
@jayisray
Dec 17 2016 21:16
@sorinr ah okay I see; do you know why my code doesn’t work though?
I want to be able to do it both ways
diederikquak
@diederikquak
Dec 17 2016 21:16
i can see how I change the text inside the element and the attributes, but I can't find how I can change the element itself
Sorin Ruse
@sorinr
Dec 17 2016 21:18
@jayisray think your problem is here: if($(string).hasClass("active") && string !== this) not sure when this is true
@diederikquak .attr(changes you want) for changing an element attributes
jayisray
@jayisray
Dec 17 2016 21:22
@sorinr With that line of code, I’m trying to say the following: “If there is an li, other than the one I just clicked, that is active, then do the following"
Sorin Ruse
@sorinr
Dec 17 2016 21:24
@diederikquak i have: <div id="whateverid"><a href="#">Link</a></div> and you would like to change the a into a button. how would u do it by js/jquery?
@jayisray && means AND and both conditional values must return true
jayisray
@jayisray
Dec 17 2016 21:25
@sorinr lol yea i know….
Sorin Ruse
@sorinr
Dec 17 2016 21:26
@jayisray ok the who is "this" as value ????
jayisray
@jayisray
Dec 17 2016 21:26
the newly clicked “li"
diederikquak
@diederikquak
Dec 17 2016 21:27
@sorinr I am currently stuck :(
Sorin Ruse
@sorinr
Dec 17 2016 21:27
@jayisray console.log(this) and see the result
@diederikquak with jquery i would just $("#whatever").html("<button class="myclass" id="myisbtn">Hello</button>");
jayisray
@jayisray
Dec 17 2016 21:30
@sorinr where am i supposed to look for the result? after entering that in
my website has a bunch of html & css
diederikquak
@diederikquak
Dec 17 2016 21:30
gonna try that out right now thx for all the help too bad i can't give you browniepoints anymore :P
Sorin Ruse
@sorinr
Dec 17 2016 21:32
@jayisray you enter it before if statement and look into the console. but i tell u. this is an object and u cannot compare string !== with this thats an object. so your && will never be true
jayisray
@jayisray
Dec 17 2016 21:34
@sorinr why can’t I compare them? in JS, doesnt it convert the string into a number first then compares them
Sorin Ruse
@sorinr
Dec 17 2016 21:39
@jayisray ur killing me:) "this" is the object in the event(the element on page you clicked on but its like: <li> with anything inside of it</li>. u cannot compare it to a string or number or whatever until you are using some of its properties
Gil
@Lancemaker
Dec 17 2016 21:48
hello
im building the "Build a Tribute Page"
do i really need to write content to it ?
i feel i will waste time in doing so. right now im using made up text
diederikquak
@diederikquak
Dec 17 2016 21:56
choice is up to you off course, but it's generally more fun to code when you're personalizing it.
Sorin Ruse
@sorinr
Dec 17 2016 22:00
@Lancemaker r u kidding? its just saying do i have to write some content for this silly page :) a page needs content that you want to show to the user.
alpox
@alpox
Dec 17 2016 22:04
@jayisray You have a browser console in your browser - developer tools - usually with F12 to open in chrome, on mac its cmd-alt-i.
A number and a string with a number in gets only properly compared with the == operator which does an un-strict comparison so 12 == "12" would result in a truthy value.
If you use the === operator, you do a strict comparison where 12 === "12" results in a falsy value, whereas 12 === 12 is true.
this is as @sorinr pointed out, an object and not a string. A string and an object are always incomparable.
Boris
@boris-in-london
Dec 17 2016 22:30
Finished the weather app, i'd appreciate some criticism. where do you think i could improve. thank you for your time.
http://codepen.io/boris-in-london/full/bBmMYp
TIMOTHY OGUNDOLA
@timothydollars
Dec 17 2016 22:31
hello,please in the second challenge, are we requeseted to build a personal portfolio webpage or repeat the sample
alpox
@alpox
Dec 17 2016 22:38
@timothydollars A personal one
@timothydollars And you have any freedom for designing i†