14th
Jul 2017
Jason Luboff
@JLuboff
Jul 14 2017 00:00
Or .map or .filter or .reduce depending on what you're trying to achieve
eyesore-
@eyesore-
Jul 14 2017 00:00
.forEach
Margaret
@Margaret2
Jul 14 2017 00:00
i think a lot of new people overuse for loops and just end up confusing themselves
eyesore-
@eyesore-
Jul 14 2017 00:00
while loop
recursion
awwsoclose
@awwsoclose
Jul 14 2017 00:01
just trying to see if one array contains elements in another array
Margaret
@Margaret2
Jul 14 2017 00:01
@awwsoclose for the mutations one i used .every() and .includes() if that helps
awwsoclose
@awwsoclose
Jul 14 2017 00:02
mmkay thanks =]
awwsoclose
@awwsoclose
Jul 14 2017 00:11
function mutation(arr) {
var arrayOne = arr[0];
var arrayTwo = arr[1];
if(arrayOne.includes(arrayTwo)){
result = true;
} else {
result = false;
}
return result;
}
all of the falses are returning correct but none of the trues are
Margaret
@Margaret2
Jul 14 2017 00:13
@awwsoclose you don't test if the whole word is included, you have to test if each letter is included in the word somewhere, could be in any order
awwsoclose
@awwsoclose
Jul 14 2017 00:14
the first one is arr=["hello", "hey"]

function caseInSwitch(val) {
switch (val) {
case alpha:
break;
case beta:
break;
case gamma:
break;
case delta:
break;
}
}
Manish Giri
@Manish-Giri
Jul 14 2017 00:21
@AnonymousLords in the first case, case alpha: - what is supposed to happen?
John
@AnonymousLords
Jul 14 2017 00:22
Write a switch statement which tests val and sets answer for the following conditions:
1 - "alpha"
2 - "beta"
3 - "gamma"
4 - "delta"
Margaret
@Margaret2
Jul 14 2017 00:22
@AnonymousLords your switch statement is not doing anything lol ....
John
@AnonymousLords
Jul 14 2017 00:22
oh
They could of showed me a example instead of pseudocode code
So how do i test it
aRtoo
@artoodeeto
Jul 14 2017 00:27
@AnonymousLords im here bro
John
@AnonymousLords
Jul 14 2017 00:27
i need help with this switch
how do i test if its alpha
or anything else
aRtoo
@artoodeeto
Jul 14 2017 00:29
@AnonymousLords bro first of since the function is invoking a value numerically. so ur switch should be a number
John
@AnonymousLords
Jul 14 2017 00:29
?
so say alpha is equal to 1
it says alpha is not defined
aRtoo
@artoodeeto
Jul 14 2017 00:31
@AnonymousLords nope bro.like this. i wont give you the whole answer.
switch(val){
case 1:
//statement.
@AnonymousLords thats how you do it bro. because fcc is invoking a number
John
@AnonymousLords
Jul 14 2017 00:33
humm
aRtoo
@artoodeeto
Jul 14 2017 00:35
@AnonymousLords anyway bro. i dont want to leave u hanging ill give u the answer just understand it.
@AnonymousLords

function caseInSwitch(val) {
// Only change code below this line

switch(val){
case 1:
break;

case 2:
break;

case 3:
break;

case 4:
break;

}

// Only change code above this line
}

// Change this value to test
caseInSwitch(4);
@AnonymousLords try it. put default. i forgot.
John
@AnonymousLords
Jul 14 2017 00:36
ohhh'
thanks
So basicallys its else if statement thanks @artoodeeto
CamperBot
@camperbot
Jul 14 2017 00:39
anonymouslords sends brownie points to @artoodeeto :sparkles: :thumbsup: :sparkles:
aRtoo
@artoodeeto
Jul 14 2017 00:39
@AnonymousLords yup.
John
@AnonymousLords
Jul 14 2017 00:40
@artoodeeto How long you bene coding
aRtoo
@artoodeeto
Jul 14 2017 00:42
2 months i think. but started fcc but i started fcc like last feb. i just stopped and came back
Ronique Ricketts
@RoniqueRicketts
Jul 14 2017 00:47
@artoodeeto good to be back isn't it?
aRtoo
@artoodeeto
Jul 14 2017 00:48
@RoniqueRicketts yea. so true. i was learning how to invest in stockmarket. but after loosing 1.5k i stopped. hahaha. it was slow though like 100 or 50 sometimes 20. never lose it at once
awwsoclose
@awwsoclose
Jul 14 2017 00:57
function mutation(arr) {
var arrayOne = arr[0];
var arrayTwo = arr[1];

for (var i=0; i<arrayOne.length;i++)
{ if (arrayTwo.indexOf(arrayOne[i]));{
result = true;
}
}
}
this is what i have so far, still not working
John
@AnonymousLords
Jul 14 2017 01:00
@artoodeeto Same :D I started in January, stopped comeback full force :D
Christopher Blakely
@chrisbchrist
Jul 14 2017 01:03
@awwsoclose You did not declare result, you should use return true. What is the exercise goal for this one?
awwsoclose
@awwsoclose
Jul 14 2017 01:03
Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
Moisés Man
@moigithub
Jul 14 2017 01:04
@awwsoclose fcc test expect mutation function returns either true or false
also.. ; is statement terminator
awwsoclose
@awwsoclose
Jul 14 2017 01:04
oh i didn't know that
Christopher Blakely
@chrisbchrist
Jul 14 2017 01:05
@awwsoclose That will make it end at the first match, so if there's more matches it won't find them, returning true will end the loop before it completes
Also, if you are searching through the first element, you'd want to use indexOf as a method on that one
awwsoclose
@awwsoclose
Jul 14 2017 01:11
some of them are working but some of them arent
i think it's something wrong with my for loop
Manish Giri
@Manish-Giri
Jul 14 2017 01:19
@awwsoclose if (arrayTwo.indexOf(arrayOne[i]));
first, delete the ;
your variables are strings, might be good to rename them accordingly
var arrayOne = arr[0];
var arrayTwo = arr[1];
Nick Janne
@njanne19
Jul 14 2017 01:20
I'm trying to make a program to make my own map for the Dungeon Game react project, do you know if there's anyway I can make it so the method this.clicker() is called even when I hold my mouse down? (i.e. so I am able to drag my mouse over multiple cells and call them as walls all at once?)
https://codepen.io/njanne19/pen/WOPVZj?editors=1111
Manish Giri
@Manish-Giri
Jul 14 2017 01:20
last, return halts the function, as Chris mentioned
Nathaniel Suchy
@nsuchy
Jul 14 2017 01:37

function convertHTML(str) {

var arr = str.split('');

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

if (arr[i] == "&") {
arr[i] = "&amp;";
}
else if (arr[i] == "<") {
arr[i] = "&lt;";
}
else if (arr[i] == ">") {
arr[i] = "&gt;";
}
else if (arr[i] == "\"") {
arr[i] = "&quot;";
}
else if (arr[i] == "'") {
arr[i] = "&apos;";
}
else {
/* No Change Needed */
}

}

return arr.join('');

}

convertHTML("Dolce & Gabbana");
What methods did you guys use?
If it had, had anything more to replace I could of made a switch for massive replacement
korzo
@korzo
Jul 14 2017 01:43
@nsuchy I use object for target:replacement
var replacement = {
'<': '&lt;',
'&': '&amp;',
'>': '&gt;',
'"': '&quot;',
"'": '&apos;'
};
Nathaniel Suchy
@nsuchy
Jul 14 2017 01:46
Nice, that code looks clean :D
John
@AnonymousLords
Jul 14 2017 01:49
Ronique Ricketts
@RoniqueRicketts
Jul 14 2017 01:50
@artoodeeto thats sad.. but at least you got the experience. :)
John
@AnonymousLords
Jul 14 2017 01:51
kumquatfelafel
@kumquatfelafel
Jul 14 2017 01:52
@AnonymousLords why would it work? The cases don't match. apple should correspond to "a", not "1"
:p
John
@AnonymousLords
Jul 14 2017 01:53
i changed the numbers with a, b & c
and it
wait for it
doesn't work still
kumquatfelafel
@kumquatfelafel
Jul 14 2017 01:53
Post code.
John
@AnonymousLords
Jul 14 2017 01:54

function switchOfStuff(val) {
switch (val) {
case a:
break;

case b:
break;

case c:
break;

default:
}
}

switchOfStuff(1);
default works
korzo
@korzo
Jul 14 2017 01:54
@AnonymousLords case "a"
John
@AnonymousLords
Jul 14 2017 01:54
the "switchOfStuff(1)" was their when i went to teh challange
thanks @korzo @kumquatfelafel
CamperBot
@camperbot
Jul 14 2017 01:55
anonymouslords sends brownie points to @korzo and @kumquatfelafel :sparkles: :thumbsup: :sparkles:
John
@AnonymousLords
Jul 14 2017 01:55
I didnt know it mattered
oh waitr
it uses strict
kumquatfelafel
@kumquatfelafel
Jul 14 2017 01:55
@AnonymousLords You need the "" to let it know that you're talking about a string literal. Nothing to do with using strict
John
@AnonymousLords
Jul 14 2017 01:55
like switch uses ===to determine, not ==
oh
kumquatfelafel
@kumquatfelafel
Jul 14 2017 01:57
without "", it gets confused since it thinks you're talking about a variable named a, b, and c respectively ;)
@zanisis
Jul 14 2017 01:58
guys any body explanation to me
const foo = {
bar : function () { return this.baz },
baz: 1,
}

console.log((function(){
return typeof arguments[0]()
})(foo.bar))
why the result is undefined?
John
@AnonymousLords
Jul 14 2017 02:00
@kumquatfelafel @korzo :point_up: July 13, 2017 9:58 PM
Shanon Jackson
@ShanonJackson
Jul 14 2017 02:01
How can i get a sessionId out of my cookies? document.cookie doesn't return it to me but its definitely there when i check in DevTools
korzo
@korzo
Jul 14 2017 02:03
@zanisis Because this refers to function, not to foo object
Nick Janne
@njanne19
Jul 14 2017 02:04
Is there any possible way to have an event listener for clicked and mouse down in React? I'm trying to make a grid that toggles cells if I drag over them
John
@AnonymousLords
Jul 14 2017 02:04
rooms
CamperBot
@camperbot
Jul 14 2017 02:04

#### freeCodeCamp rooms:

:point_right: Here is a list of our official chat rooms
Nick Janne
@njanne19
Jul 14 2017 02:04
I'm trying to make a program that makes the map I'm using for the Rougelike dungeon game
aRtoo
@artoodeeto
Jul 14 2017 02:05
@zanisis
Jul 14 2017 02:06
@korzo but why in the function return typeof arguments0 but if i console.log(typeof arguments0) the result is error.
korzo
@korzo
Jul 14 2017 02:06
@zanisis try
const foo = {
bar : function () { return this.baz },
baz: 1,
}

console.log((function(){
return typeof arguments[0]()
})(foo.bar.bind(foo)))
kumquatfelafel
@kumquatfelafel
Jul 14 2017 02:10
@zanisis outside of function, arguments is undefined. You can't say undefined[0]
Joseph
@revisualize
Jul 14 2017 02:15
Im at SeattleJS Meetup ... this is the current talk... https://github.com/JoshuaKGoldberg/async-await-generators-typescript-and-jquery
Nathaniel Suchy
@nsuchy
Jul 14 2017 02:16
@revisualize I need to find tech meetups in my city
Ayush Mahajan
@ay2306
Jul 14 2017 02:16
hey guys.. need some help here. please help me on how to assign clearTimeout JS method to this setTimout Method

var i = 0;
function change_color(a){
if(running_state && !inputAllowed){
removeById(a[0],a[2]);
if(i==(randomNumbers.length-1) && (a[2]=='-hovering-state')){
inputAllowed = true;
// setTimeout()
}
}
}
function run(b){
change_color([b,'-hovering-state','']);
setTimeout(change_color.bind(null,[b,'','-hovering-state']),1000);
}
for(i = 0; i < randomNumbers.length; ++i){
setTimeout(run.bind(null,randomNumbers[i]),(i*1100));
}
}
Brian
@BrianCodes33
Jul 14 2017 02:17
anyone here know react native
Nathaniel Suchy
@nsuchy
Jul 14 2017 02:20
@BrianCodes33 Not me but maybe soon depending on when I decide to learn it xD
stalin
@stalintouch
Jul 14 2017 02:20
hey any javascript master, a quick question: When a function returns, what happens to the variables defined inside that function? They can potentially be accessed and modified by scheduled callbacks.?
Nathaniel Suchy
@nsuchy
Jul 14 2017 02:20
It depends were the variables defined inside out side the function?
stalin
@stalintouch
Jul 14 2017 02:20
I think they can be access but no modified
@nsuchy inside the function
korzo
@korzo
Jul 14 2017 02:21
@stalintouch yes
Ayush Mahajan
@ay2306
Jul 14 2017 02:21
Nathaniel Suchy
@nsuchy
Jul 14 2017 02:21
@stalintouch You can’t use a variable outside of it’s scope, it’s syntaxually incorrect
As for a callback function, you wrote it, so there’s not much that can happen.
stalin
@stalintouch
Jul 14 2017 02:23
right, so if you return a function inside that original function you have access to the variables outside of the returned function because of closure
korzo
@korzo
Jul 14 2017 02:23
@stalintouch
function lol() {
var i = 0;
return function() {
i++;
console.log(i);
}
}

var a = lol();
a();
a();
stalin
@stalintouch
Jul 14 2017 02:23
and the same goes for the callback, is like a return function but just declared somewhere else
excellent
Thanks @korzo @nsuchy
CamperBot
@camperbot
Jul 14 2017 02:25
stalintouch sends brownie points to @korzo and @nsuchy :sparkles: :thumbsup: :sparkles:
Moisés Man
@moigithub
Jul 14 2017 02:30
when the functions ENDS (and no references remains ) everything inside functin scope gets removed, so cant be accessed
kumquatfelafel
@kumquatfelafel
Jul 14 2017 02:36
@zanisis
Jul 14 2017 02:37
help ?
Hugo walks through 100 lamp switches numbered 1 to 100 from point A to point B. On the first trip from point A to B, Hugo pushes all the switches so that all the lights are on, on the second trip from point A to B, Hugo just pushes the switch With only 2 folded numbers. On the third trip from point A to B, Hugo just punch a switch with a number only 3 folds. And so on until Hugo goes 100 times from point A to B. Write the code to simulate Hugo's journey, and calculate how many lights are on after 100 trips from point A to B?
Ayush Mahajan
@ay2306
Jul 14 2017 02:39
please help me here. clearTimeout is not working as I intended it to be. I wanted blinking to restart after i press power button but it continues
https://codepen.io/ayush2306/pen/PjyWpz?editors=1010
kumquatfelafel
@kumquatfelafel
Jul 14 2017 02:39
@zanisis what's a folded number?
Do you mean like, hitting every switch, then hitting every second switch, then every third switch, and so on?
@zanisis
Jul 14 2017 02:44
@kumquatfelafel yes first round every single switch and second round +2 every switch and so on.
Caleb Pearman
@capearman
Jul 14 2017 02:48
Hey campers, I'm having trouble tweeting the quote on the random quote generator challenge: https://codepen.io/capearman/pen/MoPOLq?editors=1010
korzo
@korzo
Jul 14 2017 02:56
Joel Y.
@zapcannon99
Jul 14 2017 02:58
^^^
I was going to say, I remember embedding the url with the tweet button
I'm probably using the wrong terminology
Caleb Pearman
@capearman
Jul 14 2017 03:00
@korzo what do you mean by use twitter "Tweet" url?
korzo
@korzo
Jul 14 2017 03:00
@capearman https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote + '" ' + currentAuthor)
Joel Y.
@zapcannon99
Jul 14 2017 03:01
^^^
Caleb Pearman
@capearman
Jul 14 2017 03:02
@korzo oh okay...gotcha
Joel Y.
@zapcannon99
Jul 14 2017 03:04
If you need an example, just go to the example codepen and tweet a random quote it gives you.
Then look at the URL
@sandsbe
Jul 14 2017 03:14
ty @RoniqueRicketts. I think I like document.querySelector("target") better as well. Just starting to get familiar with this DOM thing.
CamperBot
@camperbot
Jul 14 2017 03:14
sandsbe sends brownie points to @roniquericketts :sparkles: :thumbsup: :sparkles:
@sandsbe
Jul 14 2017 03:16
Weird problem happening with my DOM manipulation.
document.getElementById("thequote").innerHTML = quoteArr[first]["quote"];
document.querySelector("#share").setAttribute("data-text",quoteArr[first]['quote']);
});
Ronique Ricketts
@RoniqueRicketts
Jul 14 2017 03:17
@sandsbe
Jul 14 2017 03:17
Ronique Ricketts
@RoniqueRicketts
Jul 14 2017 03:17
I am new to dom too
@sandsbe
Jul 14 2017 03:17
function replaceQuote() {
last = next;
document.getElementById("thequote").innerHTML = quoteArr[last]["quote"];
while (next === last) {
next = getRandomInt(0, 6);
}
document.querySelector("#share").setAttribute("data-text",quoteArr[last]['quote']);
}
The replaceQuote function works for changing the <p> tag but not the .setAttribute
Ronique Ricketts
@RoniqueRicketts
Jul 14 2017 03:19
@sandsbe I am forcing myself to make the next projects with vanilla js and regular dom manipulation until I learn react. I told myself it's my punishment until I learn react and redux.
@sandsbe
Jul 14 2017 03:20
HA. Punishment. Ya, the jQuery stuff, IMO, means you skip knowing the insides of the tech stack.
John
@AnonymousLords
Jul 14 2017 03:21
Is their anyway i can simplify this? I'm just curious
function abTest(a, b) {
if (a < 0 && b < 0)
return "undefined";
if (a > 0 && b > 0)
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
korzo
@korzo
Jul 14 2017 03:21
kumquatfelafel
@kumquatfelafel
Jul 14 2017 03:21
yup
slertka
@slertka
Jul 14 2017 03:22
Hi - need help with .removeClass() and .addClass
@sandsbe
Jul 14 2017 03:22
@korzo from the JS widget? I thought the setAttribute was a decent workaround. I couldn't get it to do anything.
Ronique Ricketts
@RoniqueRicketts
Jul 14 2017 03:22
I wanna have a deep understanding of javascript. I should be able to duplicate jquery codes with vanilla js comfortably.
slertka
@slertka
Jul 14 2017 03:23
when I click my temperature, it converts to celcius, but won't remove the class
korzo
@korzo
Jul 14 2017 03:23
@sandsbe
Jul 14 2017 03:24
Ok. So data-attribute works, then widget loads, stuck with initial data-attribute manipulation.
John
@AnonymousLords
Jul 14 2017 03:24
@sandsbe
Jul 14 2017 03:24
Any workaround on the Twitter? I've been all over the internet on this one.
korzo
@korzo
Jul 14 2017 03:24
@sandsbe Exactly. Use tweet url : https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote + '" ' + currentAuthor)
slertka
@slertka
Jul 14 2017 03:24
@AnonymousLords ?
I have .removeClass() called but it doesn't remove the class
I need help understanding why it isnt' working
Maybe the code wasn't updated when you looked
John
@AnonymousLords
Jul 14 2017 03:25
you can use jQurey, that challange can show you how to remove classes, i thought it might help :P
@zanisis
Jul 14 2017 03:26

i try solved like this with this question, Hugo walked past 10 lamp switches numbered 1 through 10 from point A to point B. On the first trip from point A to B, Hugo pushed all the switches so that all the lights went on, on the second trip from point A to B, Hugo just pushed the switch With only 2 folded numbers. On the third trip from point A to B, Hugo just punch a switch with a number only 3 folds. And so on until Hugo goes 10 times from point A to B. Write the code to simulate Hugo's journey, and calculate how many lights are on after 10 trips from point A to B?

let step = 10;
let doing;
let amount = 0;

//expect amount =27

for(let i=1; i<=step; i++){
doing = i
while(doing<=step){
amount++
doing+= i
}
}

console.log(amount)

anybody help with recursive?.

slertka
@slertka
Jul 14 2017 03:27
@AnonymousLords is the key that i have to call it on an ID rather than a class?
John
@AnonymousLords
Jul 14 2017 03:27
@slertka I donts ee much wrong with the remove class..
slertka
@slertka
Jul 14 2017 03:27
so rather \$('.currentT') i would need \$('#currentT')
John
@AnonymousLords
Jul 14 2017 03:27
@slertka try that
slertka
@slertka
Jul 14 2017 03:27
@AnonymousLords the FCC exercise calls on all but I'll try
@sandsbe
Jul 14 2017 03:28
@korzo What/where is that url from? Does that work after I delete the js widget?
slertka
@slertka
Jul 14 2017 03:28
@AnonymousLords didn't work.
shivam gupta
@shivamg11000
Jul 14 2017 03:28
can anyone help me with branching and merging on github
slertka
@slertka
Jul 14 2017 03:28
:-/
John
@AnonymousLords
Jul 14 2017 03:29
@slertka humm
\$('.currentT').html('Current temperature is ' + currentT + ' &#8457;'); works right?
korzo
@korzo
Jul 14 2017 03:29
@sandsbe Yes. Delete widget. Just add link element with href attribute and change url upon quote change
kumquatfelafel
@kumquatfelafel
Jul 14 2017 03:30
@slertka that's not going to work https://api.jquery.com/id-selector/
John
@AnonymousLords
Jul 14 2017 03:32
CamperBot
@camperbot
Jul 14 2017 03:32
slertka
@slertka
Jul 14 2017 03:32
@kumquatfelafel i'm confused - can you explain a bit?
Joseph
@revisualize
Jul 14 2017 03:42
hey
@sandsbe
Jul 14 2017 03:48
@korzo thanks for the direction. When I made that change it removed the Tweet icon. Tried another option and it looks like the Twitter JS is really inflexible.
CamperBot
@camperbot
Jul 14 2017 03:48
sandsbe sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
kumquatfelafel
@kumquatfelafel
Jul 14 2017 03:49
@slertka My point is that # is used for id. You have currentT as a class. <h3 class='currentT far'></h3>
slertka
@slertka
Jul 14 2017 03:49
@kumquatfelafel yeah i revised my code and selected # when i tried applying it to Ids
korzo
@korzo
Jul 14 2017 03:51
@sandsbe You can use icon from fontawesome. Otherwise with twitter widget you have to reload widget after every quote change (remove iframe, add link with data-text, call twitter init function)
Huỳnh Trần Khanh
@khanh2003
Jul 14 2017 03:53
Hi
How would you create modals in React?
@sandsbe
Jul 14 2017 03:57
@korzo I like that idea. Can't seem to remove the iframe. The link should be sufficient, with the appropriate marking.
John
@AnonymousLords
Jul 14 2017 03:59
@khanh2003 Here is the basics of react if that helps https://www.youtube.com/watch?v=QqLkkBKVDyM
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:00
@slertka Okay... I think I might have spotted something.
slertka
@slertka
Jul 14 2017 04:00
@kumquatfelafel i think i just figured it out too!
Huỳnh Trần Khanh
@khanh2003
Jul 14 2017 04:00
@AnonymousLords that doesn't help :(, i know everything in that video
basically it is a very simple to do list, and not related to react modals
John
@AnonymousLords
Jul 14 2017 04:03
John
@AnonymousLords
Jul 14 2017 04:09
@khanh2003 u good?
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:09
@slertka :+1: :)
@slertka you get it working?
John
@AnonymousLords
Jul 14 2017 04:22
Guys why doesnt this code have a error on line 6

var count = 0;
var array1 = [10,"J","Q","J","A"];

function cc(card) {
if (card == array1) {
return "5 Bet";
}
}
if (card = array1) { has the error "Expected a conditional expression and instead saw a assignment>"
Moisés Man
@moigithub
Jul 14 2017 04:23
== or === for comparison
only 1 = is for assigment
John
@AnonymousLords
Jul 14 2017 04:24
Now i did ==
And it doesnt work anymore
Moisés Man
@moigithub
Jul 14 2017 04:24
u comparing a number value.. vs an array
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:24
card is a single card. array1 is a full hand. a single card is never going to equal a full hand
John
@AnonymousLords
Jul 14 2017 04:25
so how do i compare the "Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet"" to a array?
that has 2,3,4,5,6
for example
heroiczero
@heroiczero
Jul 14 2017 04:25
@AnonymousLords i would either use a switch or if else statement to add 1 or subtract 1
Moisés Man
@moigithub
Jul 14 2017 04:26
probably u need to re-read the instructions.. u need to increase/decrease count variable.. based on card value @AnonymousLords
THEN.... after that.. evaluate count and return Hold or Bet with count value
John
@AnonymousLords
Jul 14 2017 04:27
So the car sequences don't matter?
card*
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:27
Card sequences matter, but each time function runs, you only check 1 card.
John
@AnonymousLords
Jul 14 2017 04:27
it checks one card at a time
would this work for checking 2 to 6 and 7 to 9?
```
function cc(card) {

if (card >= 2 && card <= 6) {
var count = count + 1;
return "5 Bet";
} else if (card >= 7  && card <= 9);
return "0 Hold";
}
Or would it interfere later on when the car sequences are letters and numbers?
Chasls
@Chasls
Jul 14 2017 04:29
hey all.. Im on accessing nested objects
here is my code.. Not sure what Im doing wrong.

// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line

var gloveBoxContents = myStorage.inside[glove_box];
var gloveBoxContents = myStorage.inside["glove box"];
heroiczero
@heroiczero
Jul 14 2017 04:30
@Chasls forgot car
Chasls
@Chasls
Jul 14 2017 04:30
oh......!
@heroiczero thanks!! such a dumb mistake..
CamperBot
@camperbot
Jul 14 2017 04:30
chasls sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1487 | @heroiczero |http://www.freecodecamp.com/heroiczero
John
@AnonymousLords
Jul 14 2017 04:30
:point_up: July 14, 2017 12:27 AM @kumquatfelafel Or would it interfere later on when the car sequences are letters and numbers?
Joseph
@revisualize
Jul 14 2017 04:37
This message was deleted
John
@AnonymousLords
Jul 14 2017 04:38
what you say @revisualize
you deleted it :P
Joseph
@revisualize
Jul 14 2017 04:38
I did
@AnonymousLords Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
...
...
Things to note: You should NOT be returning based on the value of the card. The value of card should only be adding or subtracting 1 from the global variable count.
The value of the global variable count is used to determine the return statement.
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:39

@AnonymousLords
return "5 Bet";
This is wrong.
return "0 Hold";
This is also wrong.

THEN.... after that, evaluate count and return Hold or Bet with count value

John
@AnonymousLords
Jul 14 2017 04:40
okay
thanks @kumquatfelafel
CamperBot
@camperbot
Jul 14 2017 04:40
anonymouslords sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
John
@AnonymousLords
Jul 14 2017 04:41
so it doenst have to be in that order of letters
Joseph
@revisualize
Jul 14 2017 04:41
@AnonymousLords did you see what I wrote?
John
@AnonymousLords
Jul 14 2017 04:41
like of j, q , k
But does it have to be in that order of 10, j, q, k or a
Joseph
@revisualize
Jul 14 2017 04:41
@AnonymousLords you need to create an if or a a switch
@AnonymousLords depends how you write it
John
@AnonymousLords
Jul 14 2017 04:42
Create a switch basically?
Like the value of a set of numbers
i mean
Joseph
@revisualize
Jul 14 2017 04:42
@AnonymousLords how about you write some code
John
@AnonymousLords
Jul 14 2017 04:43
ill try it
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:47
thanks @revisualize
CamperBot
@camperbot
Jul 14 2017 04:47
kumquatfelafel sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4343 | @revisualize |http://www.freecodecamp.com/revisualize
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:47
...
I know I was about to say something earlier.
John
@AnonymousLords
Jul 14 2017 04:51
thanks @revisualize
CamperBot
@camperbot
Jul 14 2017 04:51
anonymouslords sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4344 | @revisualize |http://www.freecodecamp.com/revisualize
John
@AnonymousLords
Jul 14 2017 04:51
I have oen more qustion guys
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
console.log("5 Bet");
count = count +1;
break;
}
}
why doesnt this work
i gtg in a couple minutes
Been a hour and i have gotten nowhere in this challange
shivam gupta
@shivamg11000
Jul 14 2017 04:52
@AnonymousLords where you have called the cc function
John
@AnonymousLords
Jul 14 2017 04:53
its below in teh code
cc(2); cc(3); cc(7); cc('K'); cc('A');
Is teh default
shivam gupta
@shivamg11000
Jul 14 2017 04:54
@AnonymousLords whats the output in console
Joseph
@revisualize
Jul 14 2017 04:54
@AnonymousLords the ; is a statement terminator
@AnonymousLords remove: var count = "";
John
@AnonymousLords
Jul 14 2017 04:55
Still doeesnt work
Joseph
@revisualize
Jul 14 2017 04:55
@AnonymousLords show all of your code
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:55
@AnonymousLords It's not going to work if you haven't finished writing it.
John
@AnonymousLords
Jul 14 2017 04:55
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
console.log("5 Bet");
count = count +1;
break;
}
}
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Im trying to figure out teh first sequence
Joseph
@revisualize
Jul 14 2017 04:56
@AnonymousLords you don't have a return statement
John
@AnonymousLords
Jul 14 2017 04:56
Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet"
Joseph
@revisualize
Jul 14 2017 04:56
@AnonymousLords remove: console.log("5 Bet");
John
@AnonymousLords
Jul 14 2017 04:56
I try adding return and it says it can go before break
shivam gupta
@shivamg11000
Jul 14 2017 04:56
Joseph
@revisualize
Jul 14 2017 04:57
@AnonymousLords so you make a return AFTER the switch
@shivamg11000 What?
John
@AnonymousLords
Jul 14 2017 04:57
@revisualize okay
what am i returning
Joseph
@revisualize
Jul 14 2017 04:57
@AnonymousLords Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
...
...
Things to note: You should NOT be returning based on the value of the card. The value of card should only be adding or subtracting 1 from the global variable count.
The value of the global variable count is used to determine the return statement.
shivam gupta
@shivamg11000
Jul 14 2017 04:58
This message was deleted
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:58
Say I have the cards 2,4, and 5. What do you think it should return? @AnonymousLords
Joseph
@revisualize
Jul 14 2017 04:58
@kumquatfelafel nothing
John
@AnonymousLords
Jul 14 2017 04:58
("5 Bet");
"5 Bet"
Joseph
@revisualize
Jul 14 2017 04:58
no!
kumquatfelafel
@kumquatfelafel
Jul 14 2017 04:58
@AnonymousLords why?
Joseph
@revisualize
Jul 14 2017 04:59
do not return on the value of the card!
John
@AnonymousLords
Jul 14 2017 04:59
Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet"
then i return +1 to teh total count
Joseph
@revisualize
Jul 14 2017 05:00
@AnonymousLords your first set of cases works
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:00
@AnonymousLords I'm not talking about the card sequence 2,3,4,5,6. The card sequence 2,4, and 5. What should that return?
Joseph
@revisualize
Jul 14 2017 05:00
@AnonymousLords then make your if block
John
@AnonymousLords
Jul 14 2017 05:00
• 3 right?
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:00
yes. 3. And do they hold or bet?
John
@AnonymousLords
Jul 14 2017 05:00
bet
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:01
Okay. Now as @revisualize says, make the if block. And keep this in consideration when writing your return statement.
John
@AnonymousLords
Jul 14 2017 05:01
Okay i have no idea for my return statement
do i return "count"
Joseph
@revisualize
Jul 14 2017 05:02
@AnonymousLords return "count";
John
@AnonymousLords
Jul 14 2017 05:02
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
card = ("5 Bet");
card = count +1;
break;
}
return count;
}
how do i print 5 bet?
No matter what i do it doesnt do 5 bet
okay can we hurry this up, i really gtg
Joseph
@revisualize
Jul 14 2017 05:03
@AnonymousLords @AnonymousLords LOOK.. You need more code
@AnonymousLords you need an if block too
John
@AnonymousLords
Jul 14 2017 05:03
so repeat this for everyting
I AM
Joseph
@revisualize
Jul 14 2017 05:03
@AnonymousLords no
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:03
I'm gonna call it a night.
...
Night :)
John
@AnonymousLords
Jul 14 2017 05:04
it should return 3
Joseph
@revisualize
Jul 14 2017 05:04
@AnonymousLords come on.
John
@AnonymousLords
Jul 14 2017 05:04
Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet"
+1 = 2, 3, 4, 5, 6
Joseph
@revisualize
Jul 14 2017 05:04
@AnonymousLords if the count is positive, return a string with the current count and the string "Bet"
John
@AnonymousLords
Jul 14 2017 05:06
like count - count = 0 then bet, if its a negitive, then hold?
Chasls
@Chasls
Jul 14 2017 05:06

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i = 0; i < multiplyAll.length; i++) {
for ( var j = 0; i < multiplyAll.length; i++){
console.log(arr[i][j]);
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Hey all I am having trouble with this one.. Any help?
Joseph
@revisualize
Jul 14 2017 05:06
@AnonymousLords you're missing a bunch of code and expecting it to work
wonder
@wonder2991
Jul 14 2017 05:07
check your 2nd for loop @Chasls
John
@AnonymousLords
Jul 14 2017 05:07
What code am i missing
Veronica Eulenberg
@HappyViki
Jul 14 2017 05:07

@HappyViki
I feel like I’m so close! How do I avoid making an infinite loop?

function order(a,b) {return a-b;}
function range(a) {
var result = [];
for (var i = a[0]; i <= a[1]; i++) result.push(i);
return result;
}
function divisible(num,arr) {
for (var i in arr) {
if (num%arr[i]!==0) return false;
}
return true;
}

function smallestCommons(arr) {
var parameters = arr[0] * arr[1];
var sequential = range(arr.sort(order));
var result = parameters;

while (divisible(result,sequential)===false) result+parameters;
return result;
}

I’m doing Smallest Common Multiple

John
@AnonymousLords
Jul 14 2017 05:07
SHould i do this for every sequence first
Joseph
@revisualize
Jul 14 2017 05:08
@AnonymousLords no
@AnonymousLords finish the switch
John
@AnonymousLords
Jul 14 2017 05:08
what a i missing to finish it?
Joseph
@revisualize
Jul 14 2017 05:08
@AnonymousLords come on read the instructions
@AnonymousLords Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
...
...
Things to note: You should NOT be returning based on the value of the card. The value of card should only be adding or subtracting 1 from the global variable count.
The value of the global variable count is used to determine the return statement.
@AnonymousLords you have this: If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
Chasls
@Chasls
Jul 14 2017 05:11
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i = 0; i < multiplyAll.length; i++) {
for ( var j = 0; i < multiplyAll[i].length; i++){
console.log(arr[i][j]);
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
John
@AnonymousLords
Jul 14 2017 05:11
OJHHHHHHHHHHHH
Chasls
@Chasls
Jul 14 2017 05:11
still can't seem to get it to work
John
@AnonymousLords
Jul 14 2017 05:11
okay let me try soem stuff
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:12
@Chasls you're just printing to the console. You need to multiply those values and store them in product.
Joseph
@revisualize
Jul 14 2017 05:12
@Chasls console.log doesn't change product
Chasls
@Chasls
Jul 14 2017 05:12
like this..
product *= arr[i][j];
@revisualize
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:12
@Chasls try and see if works ;)
Joseph
@revisualize
Jul 14 2017 05:12
@Chasls try it
wonder
@wonder2991
Jul 14 2017 05:13
@Chasls multiplyAll.length??
Chasls
@Chasls
Jul 14 2017 05:13
:( @kumquatfelafel @revisualize nope..
Joseph
@revisualize
Jul 14 2017 05:13
@wonder2991 good catch
Chasls
@Chasls
Jul 14 2017 05:13
Yes. I changed that to arr.
its saying length can't be defined
Joseph
@revisualize
Jul 14 2017 05:14
show
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:14
var j = 0; i < multiplyAll[i].length; i++?
Joseph
@revisualize
Jul 14 2017 05:14
John
@AnonymousLords
Jul 14 2017 05:14
how come this is a bad assignment
card + count = count;
Chasls
@Chasls
Jul 14 2017 05:15
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i = 0; i < arr.length; i++) {
for ( var j = 0; i < arr[i].length; j++){
product *= arr[i][j];
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Joseph
@revisualize
Jul 14 2017 05:15
@AnonymousLords because it is
John
@AnonymousLords
Jul 14 2017 05:15
How do i add card to count
Chasls
@Chasls
Jul 14 2017 05:15
I see it...
Joseph
@revisualize
Jul 14 2017 05:15
@AnonymousLords you don't
Chasls
@Chasls
Jul 14 2017 05:15
I see it on my second for...
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:16
You have to assign from right to left, not left to right.
wonder
@wonder2991
Jul 14 2017 05:16
@Chasls j < arr[i].length
John
@AnonymousLords
Jul 14 2017 05:16
i put count + 1;
now
Joseph
@revisualize
Jul 14 2017 05:16
@AnonymousLords What?
John
@AnonymousLords
Jul 14 2017 05:16
nvm heres my code
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count + 1;
break;
}
return count;
}
Chasls
@Chasls
Jul 14 2017 05:16
@wonder thank you. I saw it as soon as I published it.. I jacked that one up.. hahah
CamperBot
@camperbot
Jul 14 2017 05:16
chasls sends brownie points to @wonder :sparkles: :thumbsup: :sparkles:
John
@AnonymousLords
Jul 14 2017 05:17
So far im just trying to add 1 to count
Not checking for bet or hold
Joseph
@revisualize
Jul 14 2017 05:17
@AnonymousLords that's the code you had earlier
John
@AnonymousLords
Jul 14 2017 05:17
Its changed up
Chasls
@Chasls
Jul 14 2017 05:17
Thank you all. Love this help chat!
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:17
@revisualize it's worse :p
John
@AnonymousLords
Jul 14 2017 05:17
So far im just trying to add +1 to count @kumquatfelafel @revisualize
Joseph
@revisualize
Jul 14 2017 05:17
@AnonymousLords this: count + 1; doesn't wok
wonder
@wonder2991
Jul 14 2017 05:17
@Chasls yeah. it happens.
John
@AnonymousLords
Jul 14 2017 05:18
How do i add a assignment?
Joseph
@revisualize
Jul 14 2017 05:18
@AnonymousLords this works: count = count +1; ... and you had this earlier!
John
@AnonymousLords
Jul 14 2017 05:19
:D
Joseph
@revisualize
Jul 14 2017 05:19
John
@AnonymousLords
Jul 14 2017 05:20
okay
Now im going to subtract count from count, if its 0 its bet, if its negative its hold.
would i do a if statement for that?
Joseph
@revisualize
Jul 14 2017 05:21
@AnonymousLords wait what?
John
@AnonymousLords
Jul 14 2017 05:21
because if i am in the negtives with my total count
Joseph
@revisualize
Jul 14 2017 05:21
@AnonymousLords If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
John
@AnonymousLords
Jul 14 2017 05:21
ik
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:22

Now im going to subtract count from count

You mean like 0?

John
@AnonymousLords
Jul 14 2017 05:22
now im trying to get the "hold" or "bet" part of my 2 threw 6
Joseph
@revisualize
Jul 14 2017 05:22
@AnonymousLords why not just create the other case statements first?
John
@AnonymousLords
Jul 14 2017 05:22
okay so dont worry about bet?
Joseph
@revisualize
Jul 14 2017 05:22
@AnonymousLords you know how to. just make them.
Mario A. Carlos
@MarioC3
Jul 14 2017 05:23
Hello Guys. I have a Gulp question.
Joseph
@revisualize
Jul 14 2017 05:23
@AnonymousLords why aren't you following the instructions?
John
@AnonymousLords
Jul 14 2017 05:23
i am
Joseph
@revisualize
Jul 14 2017 05:23
@AnonymousLords It's like you're trying to cook a steak before the pan is on the stove.
John
@AnonymousLords
Jul 14 2017 05:24
If your total count is negative, then hold, if postive then bet
Joseph
@revisualize
Jul 14 2017 05:24
@AnonymousLords you aren't.. youre doing things out of order
Mario A. Carlos
@MarioC3
Jul 14 2017 05:24
marioc3
[11:23 PM]
Hello Guys
I’m following Level UP Tutorial for GULP. Amazing tutorial. Understanding it so far… untttiiiiiiiiillll…. I try to watch and uglify the file and when I try to change something it crashes the whole program:
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
at createError (/Users/marioacarlos/odrive/Professional/Local Weather/Local-Weather-app/node_modules/gulp-uglify/lib/create-error.js:6:14)
at apply (/Users/marioacarlos/odrive/Professional/Local Weather/Local-Weather-app/node_modules/gulp-uglify/node_modules/lodash/_apply.js:16:25)
at wrapper (/Users/marioacarlos/odrive/Professional/Local Weather/Local-Weather-app/node_modules/gulp-uglify/node_modules/lodash/_createCurry.js:41:12)
at /Users/marioacarlos/odrive/Professional/Local Weather/Local-Weather-app/node_modules/gulp-uglify/lib/minify.js:54:15
at DestroyableTransform._transform (/Users/marioacarlos/odrive/Professional/Local Weather/Local-Weather-app/node_modules/gulp-uglify/composer.js:10:23)
Here’s the repository for the files I’m using: https://github.com/MarioC3/Local-Weather-app
John
@AnonymousLords
Jul 14 2017 05:25
@revisualize oh, anyways here my code, I'll better follow those instructions
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count = count +1;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count = count -1;
break;
}

return count;
}
Joseph
@revisualize
Jul 14 2017 05:25
@AnonymousLords great!
@AnonymousLords now
@AnonymousLords if the count is positive, return a string with the current count and the string "Bet"
@AnonymousLords how do you make an if?
John
@AnonymousLords
Jul 14 2017 05:26
if {}
i mean
if ()
Joseph
@revisualize
Jul 14 2017 05:27
ok
John
@AnonymousLords
Jul 14 2017 05:27
right
Joseph
@revisualize
Jul 14 2017 05:27
@AnonymousLords what condition should you have?
John
@AnonymousLords
Jul 14 2017 05:27
If the count is negitive, then hold
count is postive, then bet
Joseph
@revisualize
Jul 14 2017 05:28
@AnonymousLords if the count is positive, return a string with the current count and the string "Bet"
John
@AnonymousLords
Jul 14 2017 05:28
okay
This is my code
Whoops forget teh current count
this is my code
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count = count +1;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count = count -1;
break;

} if (count >= 0)
return count + " Bet";

if (count < 0)
return count + " Hold";

return count;
}
Joseph
@revisualize
Jul 14 2017 05:32
@AnonymousLords remove ( +
@AnonymousLords "); to ";
John
@AnonymousLords
Jul 14 2017 05:32
That is my code
Joseph
@revisualize
Jul 14 2017 05:33
does it work?
@AnonymousLords no.
John
@AnonymousLords
Jul 14 2017 05:33
Its only subtracting 1 i think
Joseph
@revisualize
Jul 14 2017 05:33
@AnonymousLords if (count < 0); { the ; is a statement terminator
John
@AnonymousLords
Jul 14 2017 05:34
Oh
That is my code now :point_up: July 14, 2017 1:28 AM
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:35
It's like the difference between me saying "If it's raining, you should carry an umbrella" and "if it's raining ................... [silence]"
John
@AnonymousLords
Jul 14 2017 05:35
Just realized
Oh
Forgot 7, 8, 9
:P
It will take a second hold on
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:35
@AnonymousLords don't technically need. You can include them if you want though.
John
@AnonymousLords
Jul 14 2017 05:37
case 7:
case 8:
case 9:
count = count + 0;
break;
Cards Sequence 7, 8, 9 should return "0 Hold"
X
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:38
@AnonymousLords It's because your condition is slightly off.
0 should be Hold, not Bet
John
@AnonymousLords
Jul 14 2017 05:39
YES
heres the final code
var count = 0;

function cc(card) {
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count = count +1;
break;
case 7:
case 8:
case 9:
count = count + 0;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count = count -1;
break;

} if (count > 0)
return count + " Bet";

if (count <= 0)
return count + " Hold";

return count;
}
thanks @kumquatfelafel @revisualize
CamperBot
@camperbot
Jul 14 2017 05:39
anonymouslords sends brownie points to @kumquatfelafel and @revisualize :sparkles: :thumbsup: :sparkles:
:warning: anonymouslords already gave kumquatfelafel points
:warning: anonymouslords already gave revisualize points
Chasls
@Chasls
Jul 14 2017 05:39
hey all again.. haha
stuck on this one now.. its kinda complicated for me.. not sure what the next step should be..

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

function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++){
for (var j = 0; j < firstName[i].length; j++){

}
}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
John
@AnonymousLords
Jul 14 2017 05:39
Thanks for not giving up on me
i gtg
wonder
@wonder2991
Jul 14 2017 05:41
@Chasls it's all there in the instructions
Joseph
@revisualize
Jul 14 2017 05:42
@Chasls firstName[i].length invalid
Chasls
@Chasls
Jul 14 2017 05:42
@wonder2991 well Im kinda confused on what to do next. I tried a few things that didn't make since. I thought about doing an if statement but I feel like thats not what they want.
@revisualize okay.. Ill give it another look and see if I can think of something.
@revisualize why is it invalid? wouldn't I pull from the next string?
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:46
@Chasls firstName is already a string. You're saying, "take some character from the string and tell me it's length".
Viktor Tiutiun
@vittorioVT
Jul 14 2017 05:47
@Chasls do you remember hasOwnProperty(prop) ? Here it's also
Chasls
@Chasls
Jul 14 2017 05:47
@kumquatfelafel ahhh I see. Hmm this is a tough one
yes i do.
so you're saying I can ditch the second line and build it with hasownproperty?
@vittorioVT
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:48
I'm not sure what your intention is more generally in terms of that inner for loop though... but I'd imagine there's another way.
CallMeOrange
@EgnaroDev
Jul 14 2017 05:48
:sake:
Viktor Tiutiun
@vittorioVT
Jul 14 2017 05:48
@Chasls 3rd :smile:
CallMeOrange
@EgnaroDev
Jul 14 2017 05:49
or 2nd based on zero-based :p
Chasls
@Chasls
Jul 14 2017 05:49
@vittorioVT okay. I might need to go over hasownp... again. also my second line still messed up.
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:49
5th if you count the barbed wires.
CallMeOrange
@EgnaroDev
Jul 14 2017 05:50
lol
@kumquatfelafel Can I see your Wikipedia viewer?
Viktor Tiutiun
@vittorioVT
Jul 14 2017 05:50
@Chasls you must first check there is firstName
@sandsbe
Jul 14 2017 05:50
Twitter and I are not friends. Anyone know how to get the Twitter js widget to re-initialize or bind to a button?
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:50
@MCTwoDigitZero haven't done those things yet. I'm laaaaazy ;)
CallMeOrange
@EgnaroDev
Jul 14 2017 05:50
oh...
Which project have you done last time?
@sandsbe
Jul 14 2017 05:51
If @korzo is still around, I never got the hack-around solution to work.
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:51
none of 'em :p
@sandsbe
Jul 14 2017 05:51
Still only tweets the first quote, none of the subsequent quotes
CallMeOrange
@EgnaroDev
Jul 14 2017 05:52
hm..
Chasls
@Chasls
Jul 14 2017 05:52
@vittorioVT I really don't see another way to do other than an IF statement.. So I am worried I am only solving the problem one way instead of learning a new better way.
CallMeOrange
@EgnaroDev
Jul 14 2017 05:53
@kumquatfelafel Well you were actually telling the truth
Chasls
@Chasls
Jul 14 2017 05:53
@vittorioVT I am sure I can solve it with an IF/else statement. And I can use the hasownproperty that way.
Viktor Tiutiun
@vittorioVT
Jul 14 2017 05:53
@Chasls you can to try this option in the second line: if (contacts[i].firstName == firstName)
Chasls
@Chasls
Jul 14 2017 05:54
okay. So they are looking for an if statement then? @vittorioVT
kumquatfelafel
@kumquatfelafel
Jul 14 2017 05:55
@Chasls Solving the problem in a way that you think you can solve the problem is a good start. You can always come back later and make it the best solution ever. ;)
Who knows, maybe your solution won't even be as bad as you thought.
Viktor Tiutiun
@vittorioVT
Jul 14 2017 05:55
@Chasls yes you can to use "if" as much as you want
Chasls
@Chasls
Jul 14 2017 05:56
@kumquatfelafel ill slove it the way I know how. I just feel like theres away to do with a second for.
wonder
@wonder2991
Jul 14 2017 05:56
Viktor Tiutiun
@vittorioVT
Jul 14 2017 05:58
@Chasls then check have (contacts[i].hasOwnProperty(prop) with if
@sandsbe
Jul 14 2017 05:58
@wonder2991 how do I "push" my quote into the html there?
the quote changes on each click
function replaceQuote() {
last = next;
document.getElementById("thequote").innerHTML = quoteArr[last]["quote"];
while (next === last) {
next = getRandomInt(0, 6);
}
document.querySelector("#share").setAttribute("data-text",quoteArr[last]['quote']);
}
@sandsbe
Jul 14 2017 06:03
I've been updating the .setAttribute, which works on the first quote initialization, but none of the subsequent ones.
Chasls
@Chasls
Jul 14 2017 06:04
@vittorioVT @kumquatfelafel
got it!
Viktor Tiutiun
@vittorioVT
Jul 14 2017 06:04
@Chasls :+1:
wonder
@wonder2991
Jul 14 2017 06:06
@sandsbe you can use the qoute on the id #thequote and concatenate to the tweet url
Chasls
@Chasls
Jul 14 2017 06:06
@vittorioVT thanks for the help
CamperBot
@camperbot
Jul 14 2017 06:06
chasls sends brownie points to @vittoriovt :sparkles: :thumbsup: :sparkles:
Viktor Tiutiun
@vittorioVT
Jul 14 2017 06:07
@Chasls you're welcome
wonder
@wonder2991
Jul 14 2017 06:08
@sandsbe here is how i did it
Sourabh Rangdal
@sourabhrangdal
Jul 14 2017 06:09

Need help for fcc challenge - Show the Local Weather

The link with HTTPS doesn't work and the browser respond This site can’t be reached api.openweathermap.org refused to connect. ERR_CONNECTION_REFUSED https://api.openweathermap.org/data/2.5/weather?units=imperial&lat=21.1500&lon=79.1000&appid=f292efb0bc46aafcd988b25e1c8cc3ee

Without HTTPS the link works fine api.openweathermap.org/data/2.5/weather?units=imperial&lat=21.1500&lon=79.1000&appid=f292efb0bc46aafcd988b25e1c8cc3ee

Karan Nandha
@karann7
Jul 14 2017 06:09
yeah so thats a issue with openweather
they won't accept https and codepen wont send https
so you have to use a different api, Darksky is good
wonder
@wonder2991
Jul 14 2017 06:11
@sourabhrangdal use https://darksky.net/dev/
Sourabh Rangdal
@sourabhrangdal
Jul 14 2017 06:11
@wonder2991 Thank you wonder, let me try
@sandsbe
Jul 14 2017 06:11
@wonder2991 elegant. Need a few minutes to digest.
CallMeOrange
@EgnaroDev
Jul 14 2017 06:13
Isn't openweathermap a http?
@sandsbe
Jul 14 2017 06:14
I see. I could use .setAttribute and adjust the href with the link out in the js function where you simply + the quote
@wonder2991 ty
CamperBot
@camperbot
Jul 14 2017 06:14
sandsbe sends brownie points to @wonder2991 :sparkles: :thumbsup: :sparkles:
wonder
@wonder2991
Jul 14 2017 06:17
@sandsbe yeah, that's what i was trying to say. i'm no good at explaining.
Karan Nandha
@karann7
Jul 14 2017 06:18
can anyone help me with react and redux?
@sandsbe
Jul 14 2017 06:22
Hopefully gifs aren't frowned upon in this room
That one is at least relevant
After some trial and error, it can easily be "collapsed" by clicking the icon on the text in top right corner.
Karan Nandha
@karann7
Jul 14 2017 06:31
can anyone help with react and redux? possibly on hangouts
Rajat
@rajataudichya
Jul 14 2017 06:37
Hi guys I am trying to solve the golf challenge
but there is an issue
why is that i can write if (strokes >= 1) and not write if (strokes = 1) does java script not accept only "=" ?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 06:38
@rajataudichya== to check for equality, = is for assignment
Rajat
@rajataudichya
Jul 14 2017 06:40
was that part of any challenge ? i should go back and see that
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 06:41

@rajataudichya
By using = you assign a value to something.

x = 1 //x now equals 1
x = 2 //x now equals 2

By using == you check if something is equal to something else. This is not strict

x == 1 //is x equal to 1? (False)
x == 2 //is x equal to 2? (True)
true == 1 //does the boolean value of true equal 1? (True)

By using === you check if something is equal to something else. This is also strict.

x === 1 //is x equal to 1? (False)
x === 2 //is x equal to 2? (True)
true === 1 //does the boolean value of true equal 1? (False)

What strict does, in case it wasn't clear there, is that it checks not only the equality of the two values, it compares the types of the two values too. Using == will try and convert one side of the expression to be the same type as the other. For example, boolean and integer. The boolean value for true is 1, therefore does 1 equal 1? Yes, true. When using strict however, it does not try and convert before doing the comparison, it checks if true equals 1, which is doesn't as they are two different data types, and returns false.

mithun
@dmithun
Jul 14 2017 06:43
why is all of my code wiped out????????
CallMeOrange
@EgnaroDev
Jul 14 2017 06:44
Rajat
@rajataudichya
Jul 14 2017 06:44
@saifsmailbox98 thank you
CamperBot
@camperbot
Jul 14 2017 06:44
rajataudichya sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
CallMeOrange
@EgnaroDev
Jul 14 2017 06:44
CamperBot
@camperbot
Jul 14 2017 06:44
CallMeOrange
@EgnaroDev
Jul 14 2017 06:44
mithun
@dmithun
Jul 14 2017 06:47
it shows , We couldn't find a page for /your-username!!!!!!!!!!! @MCTwoDigitZero
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 06:47
@dmithun that profile pic or brownie points count.
CallMeOrange
@EgnaroDev
Jul 14 2017 06:48
Dude I can see your solutions..
wonder
@wonder2991
Jul 14 2017 06:50
this enough? using eval feel like cheating
https://codepen.io/wonder2991/full/ZyVxKK/
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 06:50
CallMeOrange
@EgnaroDev
Jul 14 2017 06:50
mithun
@dmithun
Jul 14 2017 06:51
whenever i try to fcc.com it goes fcc.org!!!!!!!!!!!!!!!
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 06:51
@dmithun yeah
kumquatfelafel
@kumquatfelafel
Jul 14 2017 06:52
@dmithun yup. That's to be expected. Changed to .org
mithun
@dmithun
Jul 14 2017 06:52
i have all solution in fcc.com but not in org!!!!!!!!!
CallMeOrange
@EgnaroDev
Jul 14 2017 06:52
So what :/
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 06:52
@MCTwoDigitZero :)
kumquatfelafel
@kumquatfelafel
Jul 14 2017 06:52
CallMeOrange
@EgnaroDev
Jul 14 2017 06:52
@dmithun fcc.com has to be .org now
Just copy all of your solutions to repl.it
So you won't lose it again
kumquatfelafel
@kumquatfelafel
Jul 14 2017 06:53
@MCTwoDigitZero it's not lost at all.
CallMeOrange
@EgnaroDev
Jul 14 2017 06:53
I know
If it is, I wouldn't tell him to copy his solutions :/
mithun
@dmithun
Jul 14 2017 07:01
thankx @MCTwoDigitZero @kumquatfelafel @saifsmailbox98
CamperBot
@camperbot
Jul 14 2017 07:01
dmithun sends brownie points to @mctwodigitzero and @kumquatfelafel and @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
Long Nguyen
@longnt80
Jul 14 2017 07:04
@wonder2991 try click button like this order:
. 0 . .
3+3 should be 6, not 6.00
you should remove the .00
@wonder2991 also try this:
1 + 2 = then click / 3
Jahid Bin Kibria
@jahidbinkibria
Jul 14 2017 07:06
should i use recursion in "Sum All Primes" Intermediate Algorithm Scripting
Long Nguyen
@longnt80
Jul 14 2017 07:06
@jahidbinkibria no need
wonder
@wonder2991
Jul 14 2017 07:16
@longnt80 yeah. i notice that. thanks. i'm working on it.
CamperBot
@camperbot
Jul 14 2017 07:16
wonder2991 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
Cato Myhre
@Zalmez
Jul 14 2017 07:29

shouldn't this

function randomColor() {
var R = Math.floor(Math.random() * 256);
var G = Math.floor(Math.random() * 256);
var B = Math.floor(Math.random() * 256);

var hue = "rgb(" + R + "," + G + "," + B, ")";
return hue;
}

be working just as good as this?

function randomColor() {
var hue =
"rgb(" +
Math.floor(Math.random() * 256) +
"," +
Math.floor(Math.random() * 256) +
"," +
Math.floor(Math.random() * 256) +
")";
return hue;
}
Sweet Coding :)
@SweetCodingInc
Jul 14 2017 07:30
while we're at it, why not
function randomColor() {
return "rgb(" +
Math.floor(Math.random() * 256) +
"," +
Math.floor(Math.random() * 256) +
"," +
Math.floor(Math.random() * 256) +
")";
}
Cato Myhre
@Zalmez
Jul 14 2017 07:31
I was thinking about "catching" the colors then change the text color depending on the contrast
so I thought assigning the values to each one and find the "norm" of the color. I did find a solution for this, but I'm not sure if I understand it 100% so I rather not use that way
@SweetCodingInc ty for the suggestion tho
CamperBot
@camperbot
Jul 14 2017 07:33
zalmez sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
Sweet Coding :)
@SweetCodingInc
Jul 14 2017 07:34
@Zalmez In that case you're first approach is more practical.
Rajat
@rajataudichya
Jul 14 2017 07:34
```js

function golfScore(par, strokes) {
// Only change code below this line

if (strokes == 1){
return "Hole in one!";
}

else if (strokes <= par - 2){
return "Eagle";
}

else if (strokes == par - 1){
return "Birdie";
}

else if (strokes== par){
return "Par";
}

else if (strokes == par + 1){
return "Bogey";
}

else if (strokes==par + 2){
return "Double Bogey";
}

else if (strokes >= par + 3 ){
return "Go home";
}

// Only change code above this line
}

// Change these values to test
golfScore(1, 9);
Sweet Coding :)
@SweetCodingInc
Jul 14 2017 07:34
keep calling it recursively until you find satisfying norm
Rajat
@rajataudichya
Jul 14 2017 07:34
can someone tell me what is wrong with my code
I am getting what is desired still it is showing me bugs
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:35
@rajataudichya "Hole-in-one!"
Amit Patel
@AmitP88
Jul 14 2017 07:35
hey guys, I'm doing the palindrome algorithm and I'm able to get the true palindromes correct, but my false ones aren't registering. I've inspected my code and I can't tell what's wrong with my if else statement.
Pieter Stokkink
@forkerino
Jul 14 2017 07:35
@rajataudichya spelling has to be exact
Cato Myhre
@Zalmez
Jul 14 2017 07:35
yeah @SweetCodingInc the thing is the code dosen't want to run :sparkles:
Amit Patel
@AmitP88
Jul 14 2017 07:35
wonder
@wonder2991
Jul 14 2017 07:36
@Zalmez var hue = "rgb(" + R + "," + G + "," + B + ")";
missing the last +
Amit Patel
@AmitP88
Jul 14 2017 07:36
I thought my if else statement was pretty straight forward, but for some reason my false statement isn't working
Rajat
@rajataudichya
Jul 14 2017 07:36
Got it thanks guys
thanks @forkerino
CamperBot
@camperbot
Jul 14 2017 07:36
rajataudichya sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2835 | @forkerino |http://www.freecodecamp.com/forkerino
Pieter Stokkink
@forkerino
Jul 14 2017 07:36
@AmitP88 if you get true all the time, that means the true results are not working properly either. It's just because you return true all the time.
Rajat
@rajataudichya
Jul 14 2017 07:36
thanks @saifsmailbox98
CamperBot
@camperbot
Jul 14 2017 07:36
:warning: rajataudichya already gave saifsmailbox98 points
rajataudichya sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:36
:+1:
Cato Myhre
@Zalmez
Jul 14 2017 07:36
oh lul, didn't notice. ty @wonder2991
CamperBot
@camperbot
Jul 14 2017 07:36
zalmez sends brownie points to @wonder2991 :sparkles: :thumbsup: :sparkles:
Rajat
@rajataudichya
Jul 14 2017 07:37
@saifsmailbox98 how should i avoid this?
i have been making spelling mistakes a lot
Pieter Stokkink
@forkerino
Jul 14 2017 07:37
@AmitP88 .split() without args doesn't split
Sweet Coding :)
@SweetCodingInc
Jul 14 2017 07:37
@AmitP88 : (str===str2)&& (str2===str) is entirely pointless
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:37
@rajataudichya copy-paste from the instructions.
Amit Patel
@AmitP88
Jul 14 2017 07:38
@forkerino @SweetCodingInc I see. I'll re-inspect my code. thank you :)
CamperBot
@camperbot
Jul 14 2017 07:38
amitp88 sends brownie points to @forkerino and @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:warning: amitp88 already gave sweetcodinginc points
:star2: 2836 | @forkerino |http://www.freecodecamp.com/forkerino
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:43
@AmitP88 if you don't specify a limit (separator), it's going to result in a single valued array containing the whole string.
Amit Patel
@AmitP88
Jul 14 2017 07:44
@saifsmailbox98 are you referrring to the split or join method on the string?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:45
@AmitP88 yes
@AmitP88
var str = "hello world";
str; // 'hello world'
str.split(); // [ 'hello world' ]
str.split(''); // [ 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd' ]
str.split(' '); // [ 'hello', 'world' ]
Amit Patel
@AmitP88
Jul 14 2017 07:46
@saifsmailbox98 ah ok, I gotcha
@saifsmailbox98 so str.split('').join(''); would merge the string into one long connected string right?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:50
@AmitP88 split and joining at the same time?
str.split('').join('') is equivalent to str
Amit Patel
@AmitP88
Jul 14 2017 07:51
@saifsmailbox98 yeah, it's what I did for the Reverse A String algorithm
str = str.split("").reverse().join("");
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:51
@AmitP88 yeah you need to reverse the array inbetween
Pieter Stokkink
@forkerino
Jul 14 2017 07:53
@AmitP88 also make sure to remove the characters they ask you to remove
Amit Patel
@AmitP88
Jul 14 2017 07:53
@forkerino for sure
hmmm, it's not removing the spacing between words
it worked when I did it in Reverse A String
Pieter Stokkink
@forkerino
Jul 14 2017 07:54
@AmitP88 pretty sure this reverses correctly
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:54
@AmitP88 you need to remove all non-alphanumeric
Pieter Stokkink
@forkerino
Jul 14 2017 07:54
@AmitP88 ^ but that.
and lowerCase as well
:laughing:
no need to scream
AMANAPLANACANALPANAMA
awww @saifsmailbox98 why you remove your post?
Now my joke don't make sense!
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:56
just not to confuse him
@AmitP88 try your LEVEL best. @forkerino
Amit Patel
@AmitP88
Jul 14 2017 07:57
@saifsmailbox98 thanks :) I'm trying. I think I got most of it, just working on removing the alpha-numeric characters
CamperBot
@camperbot
Jul 14 2017 07:57
amitp88 sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
Pieter Stokkink
@forkerino
Jul 14 2017 07:57
@AmitP88 most people use a RegExp
Amit Patel
@AmitP88
Jul 14 2017 07:57
@forkerino oh yeah, I was wondering about that. Is that just a parameter passed into the .replace method?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:58
@AmitP88 yes a regex and a replacement string
Pieter Stokkink
@forkerino
Jul 14 2017 07:58
@AmitP88 yeah, the first argument to .replace can be a RegExp
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 07:58
@forkerino that joke totally fits. Mine was a little too short.
Amit Patel
@AmitP88
Jul 14 2017 07:58
@saifsmailbox98 so it would be .replace(RegExp, '') ?
Pieter Stokkink
@forkerino
Jul 14 2017 07:58
:+1:
@saifsmailbox98 if you like palindromes, here's a challenge: https://www.codewars.com/kata/one-line-task-palindrome-string/train/javascript
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:00
@forkerino wow, now that is scary.
Pieter Stokkink
@forkerino
Jul 14 2017 08:01
@saifsmailbox98 took me pretty much a full day.
Amit Patel
@AmitP88
Jul 14 2017 08:01
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:01
@AmitP88 not the word RegExp.
Pieter Stokkink
@forkerino
Jul 14 2017 08:01
@AmitP88 you need to actually make a RegExp, not use the word RegExp
Owais Ahmed
@owaisehmed
Jul 14 2017 08:02
Having some difficulty understanding getters and setters

var Car = function() {
// this is a private variable
var speed = 10;

// these are public methods
this.accelerate = function(change) {
speed += change;
};

this.decelerate = function() {
speed -= 5;
};

this.getSpeed = function() {
return speed;
};
};

var Bike = function() {

// Only change code below this line.
var gear = 4;

this.setGear = function(gear){
this.gear = gear;
};

this.getGear = function(){
return gear;
};
};

var myCar = new Car();

var myBike = new Bike();
myBike.setGear();
myBike.getGear();
Is this the right way?
Rajat
@rajataudichya
Jul 14 2017 08:03
what am i doing wrong?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:03
@owaisehmed just give your parameter some other name
then gear = parameter
Amit Patel
@AmitP88
Jul 14 2017 08:03
@saifsmailbox98 @forkerino oh sorry, I thought RegExp was a reserved object or something like that
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:04
@rajataudichya not assigning anything
Pieter Stokkink
@forkerino
Jul 14 2017 08:04
@owaisehmed you don't use this before private variables
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:04
@rajataudichya is that a semicolon after case ?
Owais Ahmed
@owaisehmed
Jul 14 2017 08:05
@saifsmailbox98 can u explain a bit? as to what's happening. Its a bit vague
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:06
@owaisehmed please post your code using the proper formatting, it's hard to tell looking at a screen shot.
Pieter Stokkink
@forkerino
Jul 14 2017 08:06
@rajataudichya It will be good if you assign something to answer in your cases.
CamperBot
@camperbot
Jul 14 2017 08:06
Pieter Stokkink
@forkerino
Jul 14 2017 08:06
@saifsmailbox98 he did
Rajat
@rajataudichya
Jul 14 2017 08:06

function caseInSwitch(val) {
// Only change code below this line

switch (val){
case 1 - "alpha":
break;

case 2 - "beta":
break;

case 3 - "gamma":
break;

case 4 - "delta":
break;

}
still not getting the ans
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:06
@forkerino yeah, wrong tag
Pieter Stokkink
@forkerino
Jul 14 2017 08:06
@rajataudichya 1 - "alpha" doesn't make sense
case 1:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:07
@rajataudichya :point_up: July 14, 2017 1:36 PM
Owais Ahmed
@owaisehmed
Jul 14 2017 08:07
@saifsmailbox98 that's not a screenshot
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:07
@owaisehmed I am sorry
Owais Ahmed
@owaisehmed
Jul 14 2017 08:07

var Car = function() {
// this is a private variable
var speed = 10;

// these are public methods
this.accelerate = function(change) {
speed += change;
};

this.decelerate = function() {
speed -= 5;
};

this.getSpeed = function() {
return speed;
};
};

var Bike = function() {

// Only change code below this line.
var gear;

this.setGear = function(input){
gear = input;
};

this.getGear = function(){
return gear;
};
};

var myCar = new Car();

var myBike = new Bike();
myBike.setGear(4);
myBike.getGear();
Pieter Stokkink
@forkerino
Jul 14 2017 08:07
@owaisehmed that looks better
Owais Ahmed
@owaisehmed
Jul 14 2017 08:07
this works fine now
Pieter Stokkink
@forkerino
Jul 14 2017 08:07
:+1:
Owais Ahmed
@owaisehmed
Jul 14 2017 08:08
but can someone explain what's really happening
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:08
we are having a nice chat.
Rajat
@rajataudichya
Jul 14 2017 08:08
case 1:
break;
you mean like this?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:08
@rajataudichya assignment operator
Pieter Stokkink
@forkerino
Jul 14 2017 08:09
setGear takes an argument that it will set gear to. The private variable will be updated to input. @owaisehmed Do you understand?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:09
@rajataudichya
Rajat
@rajataudichya
Jul 14 2017 08:09
@saifsmailbox98 yes saif i am confused now previously if you remember i had asked you about assignment operators ?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:10
@rajataudichya yes == and === is used to compare two things, and it either results in true or false
@rajataudichya but = is an assignment operator that is used to assign variables the values
shivam gupta
@shivamg11000
Jul 14 2017 08:10
why my loop is going infinte
for(var i=0;i<arr.length;i++){
small = arr[i];
for(var j=0+i+1;j<arr.length;j++){
if(small>arr[j]){
small=arr[j];
index = j;
}
}
temp = arr[i];
arr[i] = small;
arr[j] = temp;
}
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:10
@rajataudichya from right to left.
Pieter Stokkink
@forkerino
Jul 14 2017 08:13
@shivamg11000 is that sorting something?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:13
@shivamg11000 not sure but arr[j] = temp; --> arr[index] = temp;
Amit Patel
@AmitP88
Jul 14 2017 08:14
@saifsmailbox98 @forkerino hey, I had to look at the solution for the algorithm, and they had /[\W_]/g as the RegExp part, but I couldn't find that in the .replace documentation or the RegExp documentation on MDN. Where did they get that from?
shivam gupta
@shivamg11000
Jul 14 2017 08:14
@forkerino yes in increasing order the arr
@saifsmailbox98 ty, I didn't looked carefully
Pieter Stokkink
@forkerino
Jul 14 2017 08:15
:+1:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:15
@shivamg11000 what if the there are no smaller element picked up from the second for loop?
shivam gupta
@shivamg11000
Jul 14 2017 08:15
@saifsmailbox98 then the element remains at its position
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:15
@shivamg11000 set index to i when you inititalize small = arr[i];
Pieter Stokkink
@forkerino
Jul 14 2017 08:15
@AmitP88 from the RegExp documentation. It is not there as a whole, but you have to compose it from the parts that they provide
Amit Patel
@AmitP88
Jul 14 2017 08:16
@forkerino oh ok, I'll take a look at it again
Pieter Stokkink
@forkerino
Jul 14 2017 08:16
@AmitP88 you'll find \W and [ ] and /g
Amit Patel
@AmitP88
Jul 14 2017 08:20
@forkerino ah ok, I see it now. \W is for characters not found in the Latin alphabet, /g is global matching so that it doesn't stop after checking the first character, and I'm guessing [] is for check for array characters?
Pieter Stokkink
@forkerino
Jul 14 2017 08:26
@AmitP88 no [ ] is a character set
@AmitP88 it matches any of the characters between the brackets.
it is necessary because \W does not include _
and you need to remove underscores
Cato Myhre
@Zalmez
Jul 14 2017 08:28
@SweetCodingInc was a little more advanced than just saving them to simple values :thought_balloon:
var rgb = ['255', '0', '0'];

function randomColorMain() {

var c = 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + ')';

var o = Math.round(((parseInt(rgb[0]) * 299) + (parseInt(rgb[1]) * 587) + (parseInt(rgb[2]) * 114)) / 1000);

//console.log(o);

if (o > 125) {
\$('#quoteContent').css('color', 'black');
\$('#quoteAuthor').css('color', 'black');
} else {
\$('#quoteContent').css('color', 'white');
\$('#quoteAuthor').css('color', 'white');
}

\$('#main').css('background-color', c);

var r = Math.round(Math.random() * 255);
var g = Math.round(Math.random() * 255);
var b = Math.round(Math.random() * 255);

rgb[0] = r;
rgb[1] = g;
rgb[2] = b;

};
Amit Patel
@AmitP88
Jul 14 2017 08:29
@forkerino ah I see.
@forkerino I tried making an if else statement this way, but I'm guessing my logic is wrong?
Pieter Stokkink
@forkerino
Jul 14 2017 08:32
@AmitP88 you need two things to compare. The lowercased and sanitized string and that same thing reversed.
str.reverse doesn't exist
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:32
@AmitP88 reverse() is used to reverse arrays
and it reverses the original one.
Pieter Stokkink
@forkerino
Jul 14 2017 08:33
@Zalmez what does that o do?
or rather, what does it mean?
@Zalmez btw if you just have numbers in your rgb array, you don't need to use parseInt
Amit Patel
@AmitP88
Jul 14 2017 08:35
@saifsmailbox98 @forkerino hmmm, I thought I was reversing the sanitized string though. I even tried creating a var str2 = str.reversed(); but that didn't work either
Pieter Stokkink
@forkerino
Jul 14 2017 08:35
@AmitP88 you cannot reverse strings directly
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:35
@AmitP88 you need to split then reverse then join
Amit Patel
@AmitP88
Jul 14 2017 08:35
@forkerino @saifsmailbox98 oooh I see
Pieter Stokkink
@forkerino
Jul 14 2017 08:36
you ARE reversing the sanitized string, but where is the original string?
Amit Patel
@AmitP88
Jul 14 2017 08:37
@forkerino if I compare it to the original string that wouldn't be valid though would it? since the original string would have spaces, non-alphanumeric characters, and capital letters
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:38
@AmitP88 save a copy of the sanitized string and call it original string. Then reverse it and compare with the original string.
Pieter Stokkink
@forkerino
Jul 14 2017 08:39
@AmitP88 yeah break it in two. First lowercase and .replace
then compare the result of that with the same thing in reverse
Amit Patel
@AmitP88
Jul 14 2017 08:41
@saifsmailbox98 @forkerino hey thanks for the tips. I've written them down for now, but I g2g to bed. It's nearly 2am here and my brain is slowing down
CamperBot
@camperbot
Jul 14 2017 08:41
:warning: amitp88 already gave saifsmailbox98 points
amitp88 sends brownie points to @saifsmailbox98 and @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2838 | @forkerino |http://www.freecodecamp.com/forkerino
Amit Patel
@AmitP88
Jul 14 2017 08:41
I'll try again tomorrow though
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:41
gn
:wave:
@AmitP88
Rajat
@rajataudichya
Jul 14 2017 08:44
has freecodecamp removed the chat option from navigation bar?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:46
@rajataudichya yeah
Rajat
@rajataudichya
Jul 14 2017 08:46
why? anyone know?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:46
@rajataudichya no idea
@rajataudichya someone said maybe because it forces one to create a github/gitter account.
Pieter Stokkink
@forkerino
Jul 14 2017 08:48
Rajat
@rajataudichya
Jul 14 2017 08:48
its funny because i thought that after reaching a certain level in challenges you might not be allowed to take help from other people
Pieter Stokkink
@forkerino
Jul 14 2017 08:49
I think this chat is a great way to learn/teach, and it definitely has helped me
so I think it's a bad thing they hid it
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:50
@forkerino I totally agree with you.
Rajat
@rajataudichya
Jul 14 2017 08:51
@saifsmailbox98 which level are you on currently?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:51
@rajataudichya level? backend
Ogundele Olumide
@Lumexralph
Jul 14 2017 08:52
Hallo :wave:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:53
@Lumexralph :wave: hi
Pieter Stokkink
@forkerino
Jul 14 2017 08:54
@Lumexralph Good day!
Ogundele Olumide
@Lumexralph
Jul 14 2017 08:56
@saifsmailbox98 @forkerino How're you guys doing?
Pieter Stokkink
@forkerino
Jul 14 2017 08:57
@Lumexralph very well. Got a few days off and finally have some time to myself.
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:57
@Lumexralph having a hard time configuring mongodb on c9
Kelechi Chinaka
@ke1echi
Jul 14 2017 08:58
morning guys :wave:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 08:58
@kelechy :wave: morning
Kelechi Chinaka
@ke1echi
Jul 14 2017 08:59
are there no instructions on the config rules on c9? @saifsmailbox98
Manish Giri
@Manish-Giri
Jul 14 2017 08:59
@Lumexralph lggggmmm :smiling_imp:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:00
@kelechy There are some instructions to set up a db, but learnyoumongo is too stupid. Having problem with the port.
Manish Giri
@Manish-Giri
Jul 14 2017 09:01
I've found everything on nodeschool stupid
@saifsmailbox98
learnyounode too
Kelechi Chinaka
@ke1echi
Jul 14 2017 09:01
pls learn..would need your help when i get to that stage :smile: @saifsmailbox98
how do u mean? @Manish-Giri
Pieter Stokkink
@forkerino
Jul 14 2017 09:02
@Manish-Giri @saifsmailbox98 They do have nice meetups here with free pizza. Some of the advanced tutorials are quite fun.
Manish Giri
@Manish-Giri
Jul 14 2017 09:03
Lucky you! @forkerino
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:04
@Manish-Giri I somehow completed git-it, howtonpm, learnyounode, expressworks,streamadventure
@forkerino Wow.
Pieter Stokkink
@forkerino
Jul 14 2017 09:05
@saifsmailbox98 @Manish-Giri If you're interested in software development in Amsterdam you can go to a meetup each night and have free pizza and drinks. You'll never go hungry. They should call it free food camp
Kelechi Chinaka
@ke1echi
Jul 14 2017 09:06
:smile: @forkerino
Pieter Stokkink
@forkerino
Jul 14 2017 09:08
It definitely breeds a race of unhealthy software developers. Pizza everyday is just nasty.
Kelechi Chinaka
@ke1echi
Jul 14 2017 09:08
thats true
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:09
@forkerino yeah
What is a kyu?
Kelechi Chinaka
@ke1echi
Jul 14 2017 09:13
i think a kind of a karate fight level
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:16
@Manish-Giri icon legendgggggggggggggm :smiling_imp:
@kelechy Bro!
Pieter Stokkink
@forkerino
Jul 14 2017 09:21
@saifsmailbox98 on codewars kyu is the level of the exercise. The lower the kyu, the higher the level of the exercise. But yeah, it stems from Japanese martial arts, I believe.
Kelechi Chinaka
@ke1echi
Jul 14 2017 09:22
:hand: morning bro @Lumexralph
makalohri
@makalohri
Jul 14 2017 09:24
@knrt10 thank you
CamperBot
@camperbot
Jul 14 2017 09:24
makalohri sends brownie points to @knrt10 :sparkles: :thumbsup: :sparkles:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:24
@forkerino okay
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:25
@saifsmailbox98 any luck with the set up?
Kelechi Chinaka
@ke1echi
Jul 14 2017 09:26
hows it going @Lumexralph
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:26
@forkerino you know the part of creating Single Page App that requires some motivation on my part?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:26
@Lumexralph I just can't figure out which port to the db is set up to.
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:26
@kelechy going well oo, want to create the interface for my Pomodoro palava
Pieter Stokkink
@forkerino
Jul 14 2017 09:26
@saifsmailbox98 what kind of DB?
@Lumexralph which part is that?
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:27
@saifsmailbox98 try our best friend google or SO
@forkerino design :worried:
@forkerino it requires as much equal time as getting the functionality to work
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:28
@Lumexralph sure
@forkerino learnyoumongo
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:29
@saifsmailbox98 which resource is that?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:29
@Lumexralph it's the nodeschool app, to learn mongodb
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:29
@saifsmailbox98 free?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:29
@Lumexralph yeah
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:30
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:30
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:30
@saifsmailbox98 thank you, about node and the express you talked about ?
CamperBot
@camperbot
Jul 14 2017 09:30
lumexralph sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:30
Pieter Stokkink
@forkerino
Jul 14 2017 09:31
@saifsmailbox98 mongo is usually on port 27017
@Lumexralph me too
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:31
@forkerino Thats exactly where I think I am looking
@forkerino I'll let you know if I need any help
Pieter Stokkink
@forkerino
Jul 14 2017 09:31
@saifsmailbox98 local? c9?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:31
@forkerino I am currently that palindrome challenge that you gave me.
Ogundele Olumide
@Lumexralph
Jul 14 2017 09:32
@forkerino and design comes easy to some people
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:32
@forkerino c9
the biggest prob
Pieter Stokkink
@forkerino
Jul 14 2017 09:32
@saifsmailbox98 is mongod running?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:32
yeah, with ./mongod and then mongo to get to the shell
I tried a couple of commands there
Pieter Stokkink
@forkerino
Jul 14 2017 09:32
any errors?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:33
nope
I'll let you know. I'll try again.
Pieter Stokkink
@forkerino
Jul 14 2017 09:33
ok
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:39
@forkerino 62 characters are way too low for that challenge
Pieter Stokkink
@forkerino
Jul 14 2017 09:39
@saifsmailbox98 muhhahahahaha
Pieter Stokkink
@forkerino
Jul 14 2017 09:49
@saifsmailbox98 the shortest solution I saw is 53 characters. Mine was a verbose 61.
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:50
@forkerino I am on 108
Pieter Stokkink
@forkerino
Jul 14 2017 09:50
@saifsmailbox98 that's not a bad start.
@saifsmailbox98 many solutions use recursion.
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:52
@forkerino Yeah recursion would be a lot shorter, but I am going to stick to mine.
Pieter Stokkink
@forkerino
Jul 14 2017 09:52
@saifsmailbox98 it is possible without.
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 09:53
@forkerino Thanks for letting me know.
CamperBot
@camperbot
Jul 14 2017 09:53
saifsmailbox98 sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2839 | @forkerino |http://www.freecodecamp.com/forkerino
zathura4240
@zathura4240
Jul 14 2017 10:05
i built this using javascript, http://stenalle.com/ how is it ?
Pieter Stokkink
@forkerino
Jul 14 2017 10:07
@zathura4240 love it
source?
I mean is it on github or something?
zathura4240
@zathura4240
Jul 14 2017 10:14
no, i was experimenting
with Math
Pieter Stokkink
@forkerino
Jul 14 2017 10:15
Math ftw
:)
I was surprised that so little code did so much.
If you put it on github I'll star it.
:sparkles: Well done!
Pethaf
@Pethaf
Jul 14 2017 10:15
@forkerino You say that know. I have a book on functional analysis on my desk at the moment. I can probably use it to scare small children.
Pieter Stokkink
@forkerino
Jul 14 2017 10:16
@Pethaf you could probably use it to scare grown men and women too.
zathura4240
@zathura4240
Jul 14 2017 10:16
Thanks a lot, i wanted a good background for my new website
I hope i get some traffic when i upload the content
Pethaf
@Pethaf
Jul 14 2017 10:18
Actually I want to program some nice graphics demos with webgl. So I have been eying re-learning linear algebra and then move onto learning 3d mathematics.
And regarding the kuy.
zathura4240
@zathura4240
Jul 14 2017 10:18
umm, in computers you don't need 3-d maths
2d math with speed manipulation appears 3-d
Pethaf
@Pethaf
Jul 14 2017 10:19
The go from high to low. I.e. 10 kuy is lower than 1 kuy. Then the dan degrees go from lower to higher again. I.e. 5 dan is higher than 2 dan.
zathura4240
@zathura4240
Jul 14 2017 10:19
dan or tan ?
Pieter Stokkink
@forkerino
Jul 14 2017 10:19
@Pethaf :smile: It's a mindfuck.
zathura4240
@zathura4240
Jul 14 2017 10:20
what is the meaning of mindfuck ?
Pethaf
@Pethaf
Jul 14 2017 10:20
@forkerino Don't dutch grades go the same way?
Pieter Stokkink
@forkerino
Jul 14 2017 10:20
something like illogical/confusing
Pethaf
@Pethaf
Jul 14 2017 10:20
I.e. a lower grade is better.
Pieter Stokkink
@forkerino
Jul 14 2017 10:20
@Pethaf nah, we go from 1 to 10
Pethaf
@Pethaf
Jul 14 2017 10:20
Or do they only do that in germany?
zathura4240
@zathura4240
Jul 14 2017 10:21
@forkerino here is my other site where is used my code:- http://yashyadav.esy.es/
Pieter Stokkink
@forkerino
Jul 14 2017 10:25
@zathura4240 :+1: :+1: :+1:
zathura4240
@zathura4240
Jul 14 2017 10:25
ty . . . is the domain name okay : www.stenalle.com I am hosting on hostgator and domain is on godaddy
Pieter Stokkink
@forkerino
Jul 14 2017 10:27
@zathura4240 I don't see any problem with it.
zathura4240
@zathura4240
Jul 14 2017 10:29
okay, thanks for feedback . These days almost every small domain is already booked, in few years domain selling business will boost :)
Innocent Tauzeni
@Telthem89
Jul 14 2017 10:42
help i want to create a function that sum up two aguments together in javascript
Ankur sharma
@ankur1163
Jul 14 2017 10:44
how do i create transparent background menu bar in bootstrap
i tried this
background-color: rgba(0, 0, 0, 0.1);
but it turns it into white
Pieter Stokkink
@forkerino
Jul 14 2017 10:45
@Telthem89 what did you try?
Saif Ur Rahman
@saifsmailbox98
Jul 14 2017 10:48
@ankur1163 if you want a tranparent element then don't color it. But that won't work with bootstrap. :(
Marianissimus
@Marianissimus
Jul 14 2017 10:50
@ankur1163 either background: none or try the opposite of what you tried background-color: rgba(0, 0, 0, 0.9);
Ankur sharma
@ankur1163
Jul 14 2017 10:52
ok
@Marianissimus i tried .9 doesnt work
if i do background none
Long Nguyen
@longnt80
Jul 14 2017 10:53
@ankur1163 do you have code?