31st
Mar 2018
Mar 31 2018 00:46
increase the number of particles and watch the cpu usage :laughing: https://codepen.io/SultanCodeCamper/full/yKKwKM/
Pedro Diaz
@Pjdaze
Mar 31 2018 00:57
if anyone can solve this let me know tired of trying lol
function getLength(str) {

const len = str.length;
return len;
}
doesnt ass the last test ...
pass*
the test lol
brianna4444
@brianna4444
Mar 31 2018 01:13
I can't figure out how to connect these functions. this is the sum all odd fib numbers intermediate algorithm challenge. Any help would be so very appreciated. Thanks!
//array with all fibonnacci numbers
function fibs(num) {
var x=[1,1];
while (((x[x.length-1]) + (x[x.length-2]))<=num){
x.push((x[x.length-1]) + (x[x.length-2]));

}
return x;

//filter only odd numbers using %2 !=0
function oddNums(x){
var oddArr= [];
for (var i=0; i<=x.length; i++){
if (x[i] %2 !=0){
oddArr.push(x[i]);
}}
return oddArr;

//sum all odd numbers using reduce function
function sum(acc, val){
return acc+val;}

//final return
return oddArr.reduce(sum());
}}
sumFibs(10);
Mar 31 2018 02:02
@brianna4444 - after you generate the list of fibonacci numbers in x, create a variable, initialize it to zero. Call it something like oddSum - so you write var oddSum = 0; Then if you just loop over your x array using a for loop and test for odd values, if you find an odd value, add it to oddSum. No additional function required, really.
Mar 31 2018 02:39
@brianna4444 Your reduce is set wrong
function sum(acc, val) {...} // this is fine
return oddArr.reduice(sum) // NOTE: not ()
Since you want to pass the sum function, not the result of that function
idk about the rest of the code, but that part of the code is definantly not going to work
Pedro Diaz
@Pjdaze
Mar 31 2018 02:41
@brianna4444 do u mind sending a link to the challenge? i want to see it
o nvm
just saw
Mar 31 2018 10:10
i am using express session middleware, i want to store sessionID in a cookie, so that when a user visits app from the same browser each time he is recognized.Is this possible?
1Mher1
@1Mher1
Mar 31 2018 11:02
@sjames1958gm I done this challenge
Hello who can help me Local and global variables
Let's get a textarea and a button.
when text is inserted into textarea and will be pressed, the text will appear in <p> </ p>.
we will also have 2 input [type = color] and select
From the first hint we choose the color of the letters
The second is the background color (background)
Select font-family from select
when applied to the Apply button, these styles will be passed to p.

<textarea rows="4" cols="50" id="txt">
</textarea>

<p id="p"></p>

<button id="btn">Click me</button> <hr>
<input type="color" id="inp1" style="font-family: Arial">
<input type="color" id="inp2" style="background-color: red">
<select id="sel1">
<option style="font-family: Arial">Font-Family</option>
</select>
<button id="btn1">Apply</button> <hr>

<input type="text" id="inp3">
<button id="btn1">Result</button>

this is my html

document.getElementById("btn").onclick=function(){
var x = document.getElementById("txt").value
document.getElementById("p").innerHTML = x
}
document.getElementById("btn1").onclick=function(){
var a =document.getElementById("inp1").value
var b =document.getElementById("inp2").value
var d =document.getElementById("sel1").value
document.getElementById("p").innerHTML = "barev"
console.log(typeof a)
console.log(typeof b)

}

document.getElementById("btn1").onclick=function(){
var z=document.getElementById("inp3").value
}

this is my JavaScript
1Mher1
@1Mher1
Mar 31 2018 11:07
when applied to the Apply button, these styles will be passed to p only this I can't do
Stephen James
@sjames1958gm
Mar 31 2018 11:20
@1Mher1 You have two buttons with the same id - not good
1Mher1
@1Mher1
Mar 31 2018 11:21
one btn second btn1
sorry i see this let me change
@sjames1958gm but again Apply button dont worked yet
Stephen James
@sjames1958gm
Mar 31 2018 11:24
@1Mher1 How doesn't it work
1Mher1
@1Mher1
Mar 31 2018 11:27
I must choose background must choose font family when click apple they should be shown my words this font family and background
@sjames1958gm mi all code and challenge I am alredy shown
Stephen James
@sjames1958gm
Mar 31 2018 11:32
@1Mher1 Does anything happen when you click Apply? console.log ?
1Mher1
@1Mher1
Mar 31 2018 11:33
@sjames1958gm yeah no error and no work apply wait a little i am show you codepan
Stephen James
@sjames1958gm
Mar 31 2018 11:47
@1Mher1 You are overwriting your function with the last onclick which is still "btn1"
1Mher1
@1Mher1
Mar 31 2018 11:50
@sjames1958gm alpply button already worked but only print barev but all standart no font family and no background they dont understand background and font-family
Stephen James
@sjames1958gm
Mar 31 2018 11:51
@1Mher1 The code above doesn't do anything with those values. You have change the element with those values
Stephen James
@sjames1958gm
Mar 31 2018 11:55
you have to use a, b, d and c and change the 'p' element
1Mher1
@1Mher1
Mar 31 2018 11:59
@sjames1958gm document.getElementById("p").innerHTML = "a"+"b"+"d" ????????
please give me this line correct code
Stephen James
@sjames1958gm
Mar 31 2018 12:05
@1Mher1 You have to set the values through the style property
1Mher1
@1Mher1
Mar 31 2018 12:07
style="font-family: Arial"> this??????????
Stephen James
@sjames1958gm
Mar 31 2018 12:11
Using this:
document.getElementById("p").style = ""
1Mher1
@1Mher1
Mar 31 2018 12:13
again dont worked apply button
document.getElementById("p").style = "" no this way no document.getElementById("p").style = "a"+"b"+"d" way
Stephen James
@sjames1958gm
Mar 31 2018 12:17
@1Mher1 Its not that simple. You have to build the correct string to assign to style
1Mher1
@1Mher1
Mar 31 2018 12:19
bottom
Stephen James
@sjames1958gm
Mar 31 2018 12:21
@1Mher1 My bad style is an object - don't set to a string
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
1Mher1
@1Mher1
Mar 31 2018 12:23
@sjames1958gm script.js:9 Uncaught TypeError: Cannot set property 'style' of undefined
at HTMLButtonElement.document.getElementById.onclick (script.js:9)
document.getElementById.onclick @ script.js:9
show me this
systems dont undertand style
Stephen James
@sjames1958gm
Mar 31 2018 12:27
@1Mher1 You are trying to set style on something that is undefined, your getElementById must be wrong
1Mher1
@1Mher1
Mar 31 2018 12:31
@sjames1958gm document.getElementById("p").innerHTML = a + b
@sjames1958gm apply button worked but show this #000000#000000
for example when i choose all black
getElementBy Id is correct
Stephen James
@sjames1958gm
Mar 31 2018 12:35
black is #000000 so that is what I would expect
1Mher1
@1Mher1
Mar 31 2018 12:36
but why my code going wrong help to write that
Stephen James
@sjames1958gm
Mar 31 2018 12:36
@1Mher1 Because you have to change the 'style' attribute of the element
1Mher1
@1Mher1
Mar 31 2018 12:43
document.getElementById("p1").innerHTML = a + b
right now this
Stephen James
@sjames1958gm
Mar 31 2018 12:47
That is only changing the content not the style
1Mher1
@1Mher1
Mar 31 2018 12:48
innerHTML chang to what?????
Stephen James
@sjames1958gm
Mar 31 2018 12:51
1Mher1
@1Mher1
Mar 31 2018 12:56
:worried:
this link I was checked but done that but style show me undifined
Stephen James
@sjames1958gm
Mar 31 2018 12:58
document.getElementById("p").style this should not give that error
Assuming you will have id="p"
1Mher1
@1Mher1
Mar 31 2018 13:00
apply button dont work
document.getElementById("p").style=a+b
Stephen James
@sjames1958gm
Mar 31 2018 13:02
@1Mher1 If you read the page, that is not how you assign styles.
@1Mher1 For example:
document.getElementById("p").style.color = a;
1Mher1
@1Mher1
Mar 31 2018 13:07
dont worked
i dont understand
Stephen James
@sjames1958gm
Mar 31 2018 13:13
You assign the value from the input to the color style
It worked for me review your code
1Mher1
@1Mher1
Mar 31 2018 13:20
Stephen James
@sjames1958gm
Mar 31 2018 13:21
@1Mher1 You have no content in p1 to change color
<p id="p1">Some text</p>
1Mher1
@1Mher1
Mar 31 2018 13:23
@sjames1958gm finally thx
CamperBot
@camperbot
Mar 31 2018 13:23
1mher1 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9152 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
1Mher1
@1Mher1
Mar 31 2018 13:24
but chellange dont endd

@sjames1958gm Enter the number in the input field

To print "yes" at Button's clicks, if the whole number is a square and "no", otherwise
The square of natural numbers is 49 square, for example 7 * 7 = 49
For example, 46 is not the case, since we will not get any number multiplied by 46

Stephen James
@sjames1958gm
Mar 31 2018 13:29
So you need to figure out how to determine if the value in the input field is a perfect square
There have to be lots of places on the internet for how to do that
Raghav Mundra
@Raghav17
Mar 31 2018 15:32
I have applied sound on the "red" div and created an "onClick" function. But the sound only play one time and dosen't play again. Someone please help!
Here's the codepen: https://codepen.io/raghav96/full/YaaaEB/
Mar 31 2018 15:48
@Raghav17 - I don't know if this is the best solution, but it seems to work. I forget where I saw this, but I found that using the .load(); method on the sound before playing it makes it work repeatably. They sound a little choppy, though, like the ends are clipped. But it enables it to repeat. Someone mentioned here or in a different chat room about the sound files being corrupted?
Raghav Mundra
@Raghav17
Mar 31 2018 15:55
soundblue.load();
Nazar
@IsaakNazar
Mar 31 2018 16:05
@Raghav17
\$(".red").click(function(){
soundred.play();

});
Mar 31 2018 16:24
@Raghav17 - yes, that is what I used, as @IsaakNazar posted, I have the .load() and then the .play().
AnimeMonster
Mar 31 2018 19:00
@KevinMulhern hey kevin hi
hi all
:D
can anyone help?
anyone that knows css?
Tiago Correia
@tiagocorreiaalmeida
Mar 31 2018 19:09
:)
AnimeMonster
Mar 31 2018 19:09
:D
give me a sec
to send the code
Tiago Correia
@tiagocorreiaalmeida
Mar 31 2018 19:10
sure np
AnimeMonster
Mar 31 2018 19:11
freecodecamp ha i will check it out
nice dude thanks
for that!
now check this plz if you want to!
body {
margin: 0;
background: url(image1.jpg);
background-size: cover;
font-family: sans-serif;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(50%,-80%);
width: 400px;
box-sizing: border box;
overflow: hidden;
}
.signIn {
position: relative;
width: 100px;
height: 50px;
background: #247ebf;
color: #fff;
text-align: center;
line-height: 50px;
font-size: 20px;
cursor: pointer;
}
.fold {
position: relative;
width: 100%;
background: rgba(17,24,34,.8);
transform-origin: top;
box-sizing: border box;
transition: 5s;
transform: perspective(2000px) rotateX(90deg);
}
.active {
transform: perspective(2000px) rotateX(0deg);
}
.fold form input[type="text"], .fold form input[type="password"] {
width: 100%;
margin-bottom: 20px;
height: 40px;
box-sizing:border box;
outline: none;
color: #fff;
background: transparent;
border: 1px solid #fff;
}
::placeholder {
color: #fff
}
.fold form input[type="submit"] {
display: block;
border: none;
outline: none;
cursor: pointer;
background: #1d2b38;
color: #fff;
}
.fold form input[type="submit"]:hover {
background: #2473bf;
}
.fold form a {
color: #fff;
margin-top: 20px;
display: block;
font-size: 14px;
text-align: right;
text-decoration: none;
font-weight: bold;
}
Tiago Correia
@tiagocorreiaalmeida
Mar 31 2018 19:12
before you ask anything how about get all of this code plus your html on a codepen?:D
AnimeMonster
Mar 31 2018 19:13
@tiagocorreiaalmeida yeap how?
im new here
:)
Tiago Correia
@tiagocorreiaalmeida
Mar 31 2018 19:13
https://codepen.io quite simple create an account and then create new pen paste in the html on the right place same for css
AnimeMonster
Mar 31 2018 19:14
hmmm i see Ok
:D
@tiagocorreiaalmeida ok i created give a sec to do it
@tiagocorreiaalmeida oh dude i found an error to javascipt part with that codepen
niceee
:DDD
DistinctWolf
@DistinctWolf
Mar 31 2018 19:51
anyone know how to link a tag to another HTML file in reactjs, I tried using the html-loader with webpack to require the html file in react file and use it in a tag's href property but I can't get it to work. And I'm using express.js and serving the main index.html with bundle.js and style.css so that's why I can't directly use local files and I don't know how to pull the html file into react app
AnimeMonster
Mar 31 2018 19:52
@FlashHero damn :P
DistinctWolf
@DistinctWolf
Mar 31 2018 19:58
AnimeMonster
Mar 31 2018 19:59
@FlashHero do you have codepen?
DistinctWolf
@DistinctWolf
Mar 31 2018 19:59
AnimeMonster
Mar 31 2018 20:00
hehe ok
DistinctWolf
@DistinctWolf
Mar 31 2018 20:51
Can you use file loader for html files and will it link to the css and javascript linked in that html file
AnimeMonster
Mar 31 2018 21:59
i can from html to css from js to html nope but i want to learn that too! @FlashHero
is anyone here using OS-- Kali linux
brianna4444
@brianna4444
Mar 31 2018 22:03