6th
Nov 2016
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:02
@muzzotech try
function sumPrimes(num) {
var sum = 0;

function getPrimes(max){
var primes = [];
var stuff = [];

for (var i = 2; i < max; i++){
if(!stuff[i]) {
primes.push(i);
for(var j = i << 1; j <= max; j += i){
stuff[j] = true;
}
}
}
return primes;
}

var gotPrimes = getPrimes(num);
for(var k = 0; k < gotPrimes.length; k++){
sum += gotPrimes[k];
}

return sum;
}
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:04
@Jeff-Shapiro Same result
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:04
whats it saying? i haven't actually run the code
Conor Murphy
@cmurphy580
Nov 06 2016 00:05
this website has some icons id like to link to my local weather page and they're compatible with the api i'm using. How do i go about implementing them into my page?
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:05
@cmurphy580 probably get the owners permission first
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:05
Well when it runs subPrimes(10). It equals 17 which it should, but when it tries to do (977) it is exactly the total amount it should be minus the 977.
Conor Murphy
@cmurphy580
Nov 06 2016 00:06
you can download them off his website. I'm pretty sure they're for public use
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:07
I think what's going on is that it is actually taking the number of primes between 2 and num and then adding them together instead of taking the prime numbers of num and adding them to num.
He Liu
@HeLiu
Nov 06 2016 00:07
strange....i was planning on adding the numbers from the array together and instead i just get them lined up together, not added
var people = [
{name: {first: "Alyssa", middle: "P.", last: "Hacker"}, age: 26},
{name: {first: "Ben", last: "Bitdiddle"}, age: 34},
{name: {first: "Eva", middle: "Lu", last: "Ator"}, age: 40},
{name: {first: "Lem", middle: "E.", last: "Tweakit"}, age: 45},
{name: {first: "Louis", last: "Reasoner"}, age: 21},
{name: {first: 'He',  last: 'Liu'}, age: 24}
];

function avgAge(age){
var newAverage = [];
for(var i = 0; i < people.length ; i++){
newAverage += people[i].age;

}return newAverage;

}

avgAge(people);
that returns 263440452124
not the sum....
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:08
@HeLiu you need to divide the people[i].age/people.length
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:08
@muzzotech for (var i = 2; i <= max; i++){
needs that <= max
He Liu
@HeLiu
Nov 06 2016 00:09
im not there yet
you cant do that too...it divides every number by length
ugh im so confused hold on
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:09
@HeLiu the sum must be divided by the number of people is what I'm trying to say in order to get average Age
He Liu
@HeLiu
Nov 06 2016 00:10
@muzzotech yeah i understand that but im not getting the sum right now
@HeLiu i know you need to divide by people.length. but right now my sum is 263440452124
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:10
@Jeff-Shapiro Thanks that clinched it
CamperBot
@camperbot
Nov 06 2016 00:10
muzzotech sends brownie points to @jeff-shapiro :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @jeff-shapiro |http://www.freecodecamp.com/jeff-shapiro
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:11
;)
He Liu
@HeLiu
Nov 06 2016 00:11
its suppose to be 190
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:11
hmmm, you're right it's just adding them together like they are an array
He Liu
@HeLiu
Nov 06 2016 00:11
@muzzotech its suppose to be 190
yeahh
i wanna access them like it a number, its giving me strings?
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:12
Add "+" to people[i].age as that will change it from a string to a number
or parseInt
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:13
can anyone help me with switch statements?
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:13
@shannonguimaraes what about switch statements?
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:14
i just don't understand the logic and what they're for
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:14
@HeLiu do you not need to seperate the age: 37 into an array again so you only have the 37
__mifflin__
@cdrainxv
Nov 06 2016 00:14
@c0d0er: I think this is what you wanted?
http://codepen.io/cdrainxv/pen/xRbEYZ?editors=1100
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:14
or how to do the challenge
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:14
@shannonguimaraes They are basically in place of if/else if/else statements
what is your code so far?
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:15
none
He Liu
@HeLiu
Nov 06 2016 00:15
@Jeff-Shapiro i dont think so? thats an object and i am accessing the object value
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:15
whats your console displaying if you show one result?
He Liu
@HeLiu
Nov 06 2016 00:16
im using replit
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:16
okay. which problem is it?
He Liu
@HeLiu
Nov 06 2016 00:16
its an old problem from my coding class not here
class is over and im doing leftover problems
Jace
@jacebenson
Nov 06 2016 00:16
I'm confused. I'm working on the tic-tac-toe challenge. I am checking if a cell is occupied, but its not working proper. if someone has a minute to look i tossed it on codepen. if you start in cell middle-middle (aka 2-2) and look at the console i'd appreciate any inout
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:16
There are 3 of them as far as I can tell.
Jace
@jacebenson
Nov 06 2016 00:16
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:17
the first one
Peter Weinberg
@no-stack-dub-sack
Nov 06 2016 00:18
So, here's my React Markdown Previewer - feeling decent about it, but having one major problem in anyone can chime in. If you try to use the tool bar when there is a lot of text (like on load) - if you scroll all the way to the top and press any button, the textarea is automatically scrolled to the bottom and i can't for the life of me figure out why. Any help would be appreciated!
http://codepen.io/no_stack_dub_sack/pen/JbPZvm
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:19
okay, this one I got for you.
For what do you want to switch, in other words what value are checking to give you an "answer"
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:20
alpha , beta...
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:21
What is their value?
well, values
Terrance
@HeroslasherX
Nov 06 2016 00:22

// Build an array of test data.
var data = [ "X" ];

// Push data onto the array. Push() appends elements to the end
// of the given array. Note that it can take more than one
// argument, each of which is individually appended to the array.
// In the output, notice that when push() takes multiple arguments
// they are appended in a left-to-right order (mimicing their
// appearence in the arguments list).
data.push( "A" );
data.push( "B", "C" );

// Output resultant array.
console.log( data );

function nextInLine(arr, item) {
// Your code here

return item; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Sorry XD I need help!!!
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:23
@shannonguimaraes let's do this on PM
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:24
whats pm
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:25
Private message
I'm doing it right now
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:25
sure
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:27
@shannonguimaraes if you look on the left where it lists All Conversations, my name should show up. Click on that one.
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:28
ok
i did
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:30
Do you see my chat?
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:31
yes
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:32
okay, I'll just go through the whole thing there.
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:32
ok
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 00:32
@muzzotech google hangouts are the best for that ;)
c0d0er
@c0d0er
Nov 06 2016 00:33
@cdrainxv your like has all the buttons messed up
@cdrainxv thanks
CamperBot
@camperbot
Nov 06 2016 00:33
c0d0er sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:warning: c0d0er already gave cdrainxv points
__mifflin__
@cdrainxv
Nov 06 2016 00:34
@c0d0er: Not on full screen.
Both your work and break buttons are inside the large circle.
shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:39
@muzzotech @muzzotech thanks so much
CamperBot
@camperbot
Nov 06 2016 00:39
shannonguimaraes sends brownie points to @muzzotech :sparkles: :thumbsup: :sparkles:
:cookie: 4 | @muzzotech |http://www.freecodecamp.com/muzzotech
Conor Murphy
@cmurphy580
Nov 06 2016 00:41
@c0d0er did what I do mess up the buttons
@cmurphy580
this website has some icons id like to link to my local weather page and they're compatible with the api i'm using. How do i go about implementing them into my page?
https://erikflowers.github.io/weather-icons/
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:42
@shannonguimaraes :+1:

Hey I'm on the "Smallest Common Multiple" problem and was wondering why

smallestCommons([1, 5]) should return 60.

Shouldn't it be 5?

shannon guimaraes
@shannonguimaraes
Nov 06 2016 00:45

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (num) {
statement1;
break;
statement2;
break;}
statement1;
break;}
statement2;
break;}

// Only change code above this line
}

// Change this value to test
caseInSwitch(1);

there's something wrong
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:48
@shannonguimaraes get rid of the statement statements. They are unnecessary. Also you spelled "gamma" wrong
oh and it should be case '1': ...
and your switching between the val, not the num
and last but not least you are missing the last "}"
Dan Couper
@DanCouper
Nov 06 2016 00:58
@muzzotech 5 is not a multiple of 2,3 or 4
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 00:59
But it is a multiple of 1, right?
Dan Couper
@DanCouper
Nov 06 2016 00:59
Everything is. It isn't a multiple of 2 3 or 4 though.
Lowest of 1, 5 inclusive is 60
Nothing lower is a multiple
Nicola Scaramuzzo
@muzzotech
Nov 06 2016 01:00
oh, okay I see.
it needs to be a multiple of 2, 3, 4 as well as 5
I get it now
Dan Couper
@DanCouper
Nov 06 2016 01:01
it's not asking for the lowest multiple of two numbers
It's a range
c0d0er
@c0d0er
Nov 06 2016 01:04
@cmurphy580 i didnt get your example
@cdrainxv thanks
CamperBot
@camperbot
Nov 06 2016 01:05
c0d0er sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:cookie: 743 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
__mifflin__
@cdrainxv
Nov 06 2016 01:07
@c0d0er: Does that work? I think that’s what you wanted?
shannon guimaraes
@shannonguimaraes
Nov 06 2016 01:07
@muzzotech .... thanks
CamperBot
@camperbot
Nov 06 2016 01:07
shannonguimaraes sends brownie points to @muzzotech :sparkles: :thumbsup: :sparkles:
:warning: shannonguimaraes already gave muzzotech points
c0d0er
@c0d0er
Nov 06 2016 01:08
@cdrainxv no, the buttons are all messed up in my computer, maybe you changed something
__mifflin__
@cdrainxv
Nov 06 2016 01:09
@c0d0er: Oh, sorry… I changed it not on full view… it was on half view… let me fix that… give me a second.
shannon guimaraes
@shannonguimaraes
Nov 06 2016 01:16

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {

break;

break;

break;

break;}

// Only change code above this line
}

// Change this value to test
caseInSwitch(1);

still not working
c0d0er
@c0d0er
Nov 06 2016 01:17
@cdrainxv np
Damnuel Coleman West
@Dalton-West
Nov 06 2016 01:18
I'm stuck on the convert Celsius to Fahrenheit lesson
Tim
@agentatomic
Nov 06 2016 01:19
@shannongm function caseInSwitch(val) { var answer = ""; // Only change code below this line switch(val) { case (1): answer = "alpha"; break; case (2): answer = "beta"; break; case (3): answer = "gamma"; break; case (4): answer = "delta"; break; }
only have to say case (1), case (2) etc. No need to call the function.
Damnuel Coleman West
@Dalton-West
Nov 06 2016 01:21

''' function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

fahrenheit *= 9/5 + 32;
// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(-30);'''

CamperBot
@camperbot
Nov 06 2016 01:21
:bulb: to format code use backticks!  more info
Damnuel Coleman West
@Dalton-West
Nov 06 2016 01:21

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

fahrenheit *= 9/5 + 32;
// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(-30);

Tim
@agentatomic
Nov 06 2016 01:22
fahrenheit = celsius * (9/5) + 32;
you are multiplying by fahrenheit, need to multiply by celcius to get the fahernheit value
Damnuel Coleman West
@Dalton-West
Nov 06 2016 01:23
oh
so i call on the (celsius)
Thank you
Tim
@agentatomic
Nov 06 2016 01:24
yes, use the celsius variable which is the argument to the function. So if you call "convertToF(50)" the code will say fahrenheit is equal to 50 * 9/5 + 32
np
Somia ♡
Nov 06 2016 01:42
i need help
Moisés Man
@moigithub
Nov 06 2016 01:42
@heebzstreet no dot notatin with variables.. use brackets
Bobby
@heebzstreet
Nov 06 2016 01:43
for all of them? I don't understand what it means by variables
@moigithub
Moisés Man
@moigithub
Nov 06 2016 01:45
probably the correct technical name should be "arguments" function update(id, prop, value) {
but.. dot and bracket notation its some previous exercises.. probably u need to review
Bobby
@heebzstreet
Nov 06 2016 01:45
ohhhh, i always refer to it as parameter..So if it's multiple "arguments" you have to use brackets?
Moisés Man
@moigithub
Nov 06 2016 01:47

var myObj = { name: 'toy'};
myObj.name <-- will return 'toy' cuz myobject have a property called 'name' (dot notation)
but if u do

var myObj = {  name: 'toy'};
myprop = 'name';

myObj.myprop <-- this will try to access a property named myprop.. but myobj doesnt have (myprop is a variable,, which hold the property name)

soo.. using variables (or arguments ) u need to use bracket notation instead.. (dot notation is a string literal )
myObj[myprop] <-- ill return 'toy'
Moisés Man
@moigithub
Nov 06 2016 01:51
    if(tracks.hasOwnProperty===false){
var array=[];
value.push(array);
}
that part need to be fixed
tracks isnt a variable/object
u needto check if ur album (collection[id]) have the property named "tracks"
Bobby
@heebzstreet
Nov 06 2016 01:55
so is that done by doing (collection[id].hasOwnProperty("tracks")===false)
Connor O'Shea
@foreverifilm
Nov 06 2016 02:09

Instructions: Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found"
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here

}

// Test your code by modifying these values

He Liu
@HeLiu
Nov 06 2016 02:12
Write a function that, when given people and an age as arguments, returns an array of just the people that are older than the specified age.
var people = [
{name: {first: "Alyssa", middle: "P.", last: "Hacker"}, age: 26},
{name: {first: "Ben", last: "Bitdiddle"}, age: 34},
{name: {first: "Eva", middle: "Lu", last: "Ator"}, age: 40},
{name: {first: "Lem", middle: "E.", last: "Tweakit"}, age: 45},
{name: {first: "Louis", last: "Reasoner"}, age: 21},
{name: {first: 'He',  last: 'Liu'}, age: 24}
];

function olderThan(people, num){
var array =[];
for(var i = 0 ; i < people.length ; i++){
if(people[i].age > num){
array.push(people[i].name.first + " " + (people[i].name.middle ? (people[i].name.middle + " ") : '') + people[i].name.last);
}

}
return array;
}

console.log(olderThan(19))
why is nothing being pushed into the array?
Moisés Man
@moigithub
Nov 06 2016 02:14
@HeLiu ur funciton accept 2 arguments
u only passing 1 value console.log(olderThan(19))
__mifflin__
@cdrainxv
Nov 06 2016 02:15
@c0d0er: Sorry it took longer than I thought it would. I went a head and made it so that it looks relatively the same regardless of the size of the screen:
http://codepen.io/cdrainxv/pen/xRbEYZ?editors=1100
He Liu
@HeLiu
Nov 06 2016 02:15
@moigithub omg thank you!!
CamperBot
@camperbot
Nov 06 2016 02:15
heliu sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2185 | @moigithub |http://www.freecodecamp.com/moigithub
Connor O'Shea
@foreverifilm
Nov 06 2016 02:25
How do I add a new album to the myMusic Array along with a new artist and title string.
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}
"artist": "Vampire Weekend",
"title": "Contra",
"release_year": 2010,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true/ Add record here
];
c0d0er
@c0d0er
Nov 06 2016 02:29
@cdrainxv thanks, why did you put the adjusting buttons in the big button? cannot make outside liek earlier?
CamperBot
@camperbot
Nov 06 2016 02:29
c0d0er sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:cookie: 744 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
__mifflin__
@cdrainxv
Nov 06 2016 02:34
@c0d0er: :fearful: Sorry… I thought that’s what you meant… by putting them in the big circle...
Pierre
@Snack-Pack
Nov 06 2016 02:35

var joinMe = ["Split","me","into","an","array"];
var joinedString = '';

// Only change code below this line.

var joinedString = joinMe;
var joinMe = joinMe.join(" "); Use the join method to create a string from joinMe with spaces in between each element and assign it to joinedString. (can anyone see my mistake)

c0d0er
@c0d0er
Nov 06 2016 02:36
@cdrainxv sorry, it's my bad, actually i just want to let the - and + in the button if the font-size is 50 px
@cdrainxv thanks! i am checking your settings
CamperBot
@camperbot
Nov 06 2016 02:36
c0d0er sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:warning: c0d0er already gave cdrainxv points
c0d0er
@c0d0er
Nov 06 2016 02:40
@cdrainxv did you use span { position: relative; top: -16px; } to adjust the + and - position to higher into inside of the small button?
__mifflin__
@cdrainxv
Nov 06 2016 02:41
@c0d0er: yes.
Connor O'Shea
@foreverifilm
Nov 06 2016 02:43

How do I assign the contents of the glove box property to the gloveboxcontents variable? // Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};
myStorage.car["inside"].glovebox; // "secrets"
myStorage.outside.trunk; // "stapler"
// Only change code below this line

var gloveBoxContents = "glove box"; // Change this line

Muktalgrg
@Muktalgrg
Nov 06 2016 02:44

i'm not getting desired result. Can anyone find mistake here?
var range1 = prompt("Enter number 1");
var range2 = prompt("Enter number 2");
var largeNum;
var smallNum;
if(range1 > range2){
largeNum = range1;
smallNum = range2;
}else if(range2 > range1){
largeNum = range2;
smallNum = range1;
}else if(range1 === range2){
}

var randomNumberGenerator = Math.floor(Math.random()*(largeNum - smallNum+1)+smallNum);
console.log(randomNumberGenerator);

Connor O'Shea
@foreverifilm
Nov 06 2016 02:47

Can someone please help me with this. I'm not sure exactly what this exercise is asking me. Thanks.
//Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

function nextInLine(arr, item) {
// Your code here

return item; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Dylan
@dhcodes
Nov 06 2016 02:47
@foreverifilm consider checking out .push() and .shift() methods on MDN
envision a line of people. You are adding the item parameter to the end of the line (the array) and then returning the first person (item) in the array.
Connor O'Shea
@foreverifilm
Nov 06 2016 02:53

How do i get this desired output from my stroke to par ratio?
function golfScore(par, strokes) {
// Only change code below this line

return "Go Home";
// Only change code above this line
}

// Change these values to test
golfScore(5, 4);

//Strokes Return
//1 "Hole-in-one!"
//<= par - 2 "Eagle"
//par - 1 "Birdie"
//par "Par"
//par + 1 "Bogey"
//par + 2 "Double Bogey"
//>= par + 3 "Go Home!"
par and strokes will always be numeric and positive.

Walid Ashri
@walidashri
Nov 06 2016 02:54
@c0d0er thanks
CamperBot
@camperbot
Nov 06 2016 02:54
walidashri sends brownie points to @c0d0er :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @c0d0er |http://www.freecodecamp.com/c0d0er
__mifflin__
@cdrainxv
Nov 06 2016 02:56
@foreverifilm: use if/else if/else statement.
@walidashri: 0/… thanks.
CamperBot
@camperbot
Nov 06 2016 02:57
cdrainxv sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 585 | @walidashri |http://www.freecodecamp.com/walidashri
Walid Ashri
@walidashri
Nov 06 2016 02:57
@cdrainxv nvm :P
@cdrainxv thank you
CamperBot
@camperbot
Nov 06 2016 02:57
walidashri sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:cookie: 747 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
c0d0er
@c0d0er
Nov 06 2016 02:58
@walidashri thanks!
CamperBot
@camperbot
Nov 06 2016 02:58
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 586 | @walidashri |http://www.freecodecamp.com/walidashri
__mifflin__
@cdrainxv
Nov 06 2016 02:58
thanks @c0d0er
CamperBot
@camperbot
Nov 06 2016 02:58
cdrainxv sends brownie points to @c0d0er :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @c0d0er |http://www.freecodecamp.com/c0d0er
c0d0er
@c0d0er
Nov 06 2016 03:18
@cdrainxv i resolved the issue with adding span tag like you used thank you for your help!
CamperBot
@camperbot
Nov 06 2016 03:18
c0d0er sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:warning: c0d0er already gave cdrainxv points
__mifflin__
@cdrainxv
Nov 06 2016 03:26
@c0d0er: no problem..
Muktalgrg
@Muktalgrg
Nov 06 2016 03:30
//i'm not getting desired result. Can anyone find mistake here?
var range1 = prompt("Enter number 1");
var range2 = prompt("Enter number 2");
var largeNum;
var smallNum;
if(range1 > range2){
largeNum = range1;
smallNum = range2;
}else if(range2 > range1){
largeNum = range2;
smallNum = range1;
}else if(range1 === range2){
}

var randomNumberGenerator = Math.floor(Math.random()*(largeNum - smallNum+1)+smallNum);
console.log(randomNumberGenerator);
Garrett
@grrttmrtn
Nov 06 2016 03:33

function getIndexToIns(arr, num) {
function sortNumber(a,b) {
return a - b;
}
arr = arr.sort(sortNumber);
console.log(arr);
for (var i = 0;i <= arr.length; i++) {
if (arr[i] >= num) {
return i;
}
}
return i+1;
}
getIndexToIns([2,5,10], 15);
Can someone help me fix this?
it works for everything expect the numbers in the code currently
Where do I belong challenge
Oniichan
@ProjectOU
Nov 06 2016 03:40
var form = $('.likeajax')[1]; what is the "[1]" here? the problem is Button1 = data1 button2 = data1 ineed to get Button1 = data1 button2 = data2 Sultan @Sultan2790 Nov 06 2016 03:45 Hello everyone ! I am trying to write a program that rolls a pair of dice until the sum of the numbers rolled in specific number. I also want to know the number of times the dice rolled to get the desired sum. Michael Cavataio @MCavataio Nov 06 2016 03:57 @Sultan2790 what are you struggling with? Sultan @Sultan2790 Nov 06 2016 04:01 Which loop should I use ? Can you help me get this problem started ? @MCavataio Please man help me Michael Cavataio @MCavataio Nov 06 2016 04:03 yeahh for sure did you start writing up some code yet? Jeremiah Biard @jeremiahbiard Nov 06 2016 04:05 @Sultan doesn't matter which one you use RakeshNerkar @Rakesh18754 Nov 06 2016 04:05 in angular js Can we view the partials in the chromes sources tab ...as i am able to view my JS , CSS of a compnent only thing missing all the HTML partials ...i am also anle to view the index.html file but not the partials .....any suggestions on this? Sultan @Sultan2790 Nov 06 2016 04:06 <html> <body> <script type = "text/JavaScript"> var dice1, dice2, sum, count, num; num = prompt ("Enter number you looking for ?"); do { dice1 = Math.floor((Math.random() 6) + 1); dice2 = Math.floor((Math.random() 6) + 1); count++; sum = dice1 + dice2; } while (sum != num); alert (sum); </script> </body> </html> Palakurthi Durga Kiran Kumar @durgakiran Nov 06 2016 04:08 http://codepen.io/Durgakiran/pen/dOPOEQ?editors=0010 why the minute variable is changing only once Muktalgrg @Muktalgrg Nov 06 2016 04:08 dice1 = parseInt(prompt(Math.floor........ i think you should first pare the string to num sorry num = parseInt..... Oniichan @ProjectOU Nov 06 2016 04:09 i need help :( Michael Cavataio @MCavataio Nov 06 2016 04:09 @Muktalgrg the Math.random function will return a number right Sultan @Sultan2790 Nov 06 2016 04:10 @Muktalgrg I did parseFloat num. How can you set up a condition to get out of the loop Muktalgrg @Muktalgrg Nov 06 2016 04:10 yes it will return number from 0 to 0.999999 Jeremiah Biard @jeremiahbiard Nov 06 2016 04:11 @durgakiran Because you check to see if seconds == 60 before you change seconds to 60 It only checks right the first time you run the function Oniichan @ProjectOU Nov 06 2016 04:12 guys$(document).ready(function(){
$(".social").click(function() { sendlike(); }); }); function sendlike(){ var form =$('#likeajax');
var formdata = new FormData(form);

var ajax = new XMLHttpRequest();
ajax.open("POST", "includes/like.php");
ajax.send(formdata);

}

$(document).ready(function(){$(".social").click(function() {
sendlike();
});
});

function sendlike(){
var form = $('#likeajax'); var formdata = new FormData(form); var ajax = new XMLHttpRequest(); ajax.open("POST", "includes/like.php"); ajax.send(formdata); } Sultan @Sultan2790 Nov 06 2016 04:12 Guys please help me Palakurthi Durga Kiran Kumar @durgakiran Nov 06 2016 04:14 @jeremiahbiard if loop for seconds is got checked every time? Sultan @Sultan2790 Nov 06 2016 04:15 How to reverse a sentence using loop ? for example, I enter Sultan is name my .. i want the output to be my name is sultan Muktalgrg @Muktalgrg Nov 06 2016 04:15 // i don't know if this is working. <html> <body> <script type = "text/JavaScript"> var dice1, dice2, sum, count = 0, num; num = parseInt(prompt ("Enter number you looking for ?")); do { dice1 = Math.floor((Math.random()* 6) + 1); dice2 = Math.floor((Math.random()* 6) + 1); count++; sum = dice1 + dice2; } while (sum != num); alert (sum); alert(count); </script> </body> </html> Sultan @Sultan2790 Nov 06 2016 04:16 @Muktalgrg this is not working .. do u know how we can fix it ? Jeremiah Biard @jeremiahbiard Nov 06 2016 04:16 @durgakiran if(seconds == 60){ <--- checks condition here minutes = minutes - 1; } if(seconds === 0){ <--- sets condition here, try moving this above the other one seconds = 60; } Muktalgrg @Muktalgrg Nov 06 2016 04:16 sorry bro Michael Cavataio @MCavataio Nov 06 2016 04:17 @sultan i'm not too familiar with do in javascript but I would wrap the whole function in a while loop Jeremiah Biard @jeremiahbiard Nov 06 2016 04:18 @Sultan2790 console.log() dice1, dice2, and sum to see if they are returning what you are expecting them to return Sultan @Sultan2790 Nov 06 2016 04:19 @jeremiahbiard Okay I will try this Muktalgrg @Muktalgrg Nov 06 2016 04:19 what if your expected sum is 5 but dice1 initally rolled 6? Sultan @Sultan2790 Nov 06 2016 04:20 @Muktalgrg Write a program that rolls a pair of dice until the sum of the numbers rolled is specific number. We also want to know the number of times the dice are rolled to get the desired sum. This is the question Jeremiah Biard @jeremiahbiard Nov 06 2016 04:20 @Muktalgrg then it will loop again and get a new dice1 and dice2 Palakurthi Durga Kiran Kumar @durgakiran Nov 06 2016 04:20 @jeremiahbiard thanks it's working CamperBot @camperbot Nov 06 2016 04:20 durgakiran sends brownie points to @jeremiahbiard :sparkles: :thumbsup: :sparkles: :cookie: 347 | @jeremiahbiard |http://www.freecodecamp.com/jeremiahbiard Jeremiah Biard @jeremiahbiard Nov 06 2016 04:20 @durgakiran you are welcome Marc M @Marc-Moeller Nov 06 2016 04:21 Hola, can anyone help me with the JS - Stand in line challenge please? I'm unsure what it is asking for and a bit rusty function nextInLine(arr, item) { // Your code here return item; // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 3)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); function nextInLine(arr, item) { // Your code here return item; // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 3)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); Jeremiah Biard @jeremiahbiard Nov 06 2016 04:22 it's asking you to return the element at arr[item] @flyyyperth Marc M @Marc-Moeller Nov 06 2016 04:22 we want: nextInLine([2], 1) should return 2 Jeremiah Biard @jeremiahbiard Nov 06 2016 04:22 console.log(nextInLine(testArr, 3)) should return 4 arr[0] = 1, arr[1] = 2, etc... Marc M @Marc-Moeller Nov 06 2016 04:23 would I add a zero to the start of the array, so the third item is 4 ? Jeremiah Biard @jeremiahbiard Nov 06 2016 04:23 array's are zero indexed the third item is already 4 ;) 1 is the zeroeth item Marc M @Marc-Moeller Nov 06 2016 04:27 cool yep. I get that. How come console.log(nextInLine(testArr, 1)); is returning 1 though. I thought it should return 2 being that two is at the position 1 in our array Oniichan @ProjectOU Nov 06 2016 04:28 @Sultan2790 for the name reverse <html> <body> <script type = "text/JavaScript"> var string; string = prompt ("Enter name in reverse looking for ?"); var x = string.split("").reverse().join("").split(" ").reverse().join(" ") for(i=0; i<=x.length; i++){ var element = x[i]; document.write(element); } </script> </body> </html> try that .. Marc M @Marc-Moeller Nov 06 2016 04:29 @jeremiahbiard - console.log(nextInLine(testArr,[2], 1)); what does the "2" stand for ? labib1211 @labib1211 Nov 06 2016 04:30 i need help Jeremiah Biard @jeremiahbiard Nov 06 2016 04:30 My bad, I didn't read what the challenge is asking for... Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed. labib1211 @labib1211 Nov 06 2016 04:31 how do i make a madlib thing Sultan @Sultan2790 Nov 06 2016 04:32 @ProjectOU Thank you for taking time to help me out. CamperBot @camperbot Nov 06 2016 04:32 sultan2790 sends brownie points to @projectou :sparkles: :thumbsup: :sparkles: :warning: could not find receiver for projectou Marc M @Marc-Moeller Nov 06 2016 04:33 @jeremiahbiard cool, Im trying to use the pop function to remove the last number form the array ? Jeremiah Biard @jeremiahbiard Nov 06 2016 04:33 Okay, but it wants you to add a number on the end and remove the first number Oniichan @ProjectOU Nov 06 2016 04:33 No problem bro $(document).ready(function(){
$(".social").click(function() { sendlike(); }); }); function sendlike(){ var form =$('#likeajax');
var formdata = new FormData(form);

var ajax = new XMLHttpRequest();
ajax.open("POST", "includes/like.php");
ajax.send(formdata);

}
help me
i cant send
Sultan
@Sultan2790
Nov 06 2016 04:34
@ProjectOU It didn't work tho :(. Can we use concatenating to do the reverse
Selvaganapathy
@selva1993
Nov 06 2016 04:35
hi everyone
Oniichan
@ProjectOU
Nov 06 2016 04:36
@Sultan2790
<html>
<body>
<script type = "text/JavaScript">
var string;
string = prompt ("Enter name in reverse looking for ?");

var x = string.split("").reverse().join("").split(" ").reverse().join(" ")

document.write(x);

</script>
</body>
</html>
try that again
Sultan
@Sultan2790
Nov 06 2016 04:38
@ProjectOU natlus si eman ym this is the output. I was trying to just reverse the words
Oniichan
@ProjectOU
Nov 06 2016 04:38
ow wait
Sultan
@Sultan2790
Nov 06 2016 04:39
@ProjectOU for example, sultan is name my .... I want the program to write it backwards
Oniichan
@ProjectOU
Nov 06 2016 04:39

<body>
<script type = "text/JavaScript">
var string;
string = "natlus";

var x = string.split("").reverse().join("").split(" ").reverse().join(" ")

document.write(x);

</script>
</body>
</html>

<body>
<script type = "text/JavaScript">
var string;
string = "sultan";

var x = string.split("").reverse().join("").split(" ").reverse().join(" ")

document.write(x);

</script>
</body>
</html>
Marc M
@Marc-Moeller
Nov 06 2016 04:40

function nextInLine(arr, item) {
// Your code here
var testArr = [1,2,3,4,5];

nextInLine.unshift([1]);

return item;  // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];
I tried to use unshift to add to the front of the array
but I get: unshift is not a function
jasonbartelds77
@jasonbartelds77
Nov 06 2016 04:43
how do i make the value two? var remainder= 5%2;
Marc M
@Marc-Moeller
Nov 06 2016 04:45
4%2; ?
var remainder= 4%2;
Muktalgrg
@Muktalgrg
Nov 06 2016 04:48
@Sultan2790 is the problem with dice solved?
Sultan
@Sultan2790
Nov 06 2016 04:48
@flyyyperth 1
Jeremiah Biard
@jeremiahbiard
Nov 06 2016 04:49
@flyyyperth you want to add to the back of the array and take the element from the front
Jose Antonio Rivas
@joseantonio
Nov 06 2016 04:52
marc
Muktalgrg
@Muktalgrg
Nov 06 2016 04:52
<html>
<body>
<script type = "text/JavaScript">

// Write a program that rolls a pair of dice until the sum of the numbers rolled is specific number.
// We also want to know the number of times the dice are rolled to get the desired sum.

var dice1, dice2, sum, count = 0; num;
var num = parseInt(prompt("Enter expected number."));

do{

dice1 = Math.floor((Math.random()*6)+1);
console.log("dice1 rolled : "+dice1);
dice2 = Math.floor((Math.random()*6)+1);
console.log("dice2 rolled : "+dice2);
sum = dice1 +dice2;
count++;
console.log("no of times dice rolled: "+count);
}while( sum !== num);

console.log("sum is : "+sum);

</script>
</body>
</html>
@Sultan2790 . i think it works
Jose Antonio Rivas
@joseantonio
Nov 06 2016 04:53
@flyyyperth try using arr.push(item);
Marc M
@Marc-Moeller
Nov 06 2016 04:53
@JorianCode
ok, cheers
Jose Antonio Rivas
@joseantonio
Nov 06 2016 04:54
that one to add the number and arr.shift() to remove it
Sultan
@Sultan2790
Nov 06 2016 04:54
@Muktalgrg I entered the number but there was no output
Muktalgrg
@Muktalgrg
Nov 06 2016 04:55
see answer in console.
ctrl + shift + i ( if you use chrome)
Sultan
@Sultan2790
Nov 06 2016 04:56
@Muktalgrg How I can print the answers on the screen
Muktalgrg
@Muktalgrg
Nov 06 2016 04:59
document.write("write within here that you want to display in your page"+value);
Sultan
@Sultan2790
Nov 06 2016 05:00
so should I replace console.log("no of times dice rolled: "+count); with alert in the beginning
Muktalgrg
@Muktalgrg
Nov 06 2016 05:02
@Sultan2790 eg: this in you line. plus see console about calculations
document.write("no of counts: "+count);
Sultan
@Sultan2790
Nov 06 2016 05:03
Okay. I am trying this. Ill let u know
Muktalgrg
@Muktalgrg
Nov 06 2016 05:07
@Sultan2790
<html>
<body>
<script type = "text/JavaScript">

// Write a program that rolls a pair of dice until the sum of the numbers rolled is specific number.
// We also want to know the number of times the dice are rolled to get the desired sum.

var dice1, dice2, sum, count = 0; num;
var num = parseInt(prompt("Enter expected number(greater than 1 less than 13)."));

do{

dice1 = Math.floor((Math.random()*6)+1);
document.write("<br> dice1 rolled : "+dice1);
dice2 = Math.floor((Math.random()*6)+1);
document.write("<br> dice2 rolled : "+dice2);
sum = dice1 +dice2;
count++;
document.write("<br> no of times dice rolled: "+count);
}while( sum !== num);

document.write("<br> your expected sum is : "+sum);
document.write("<br> no of counts: "+count);

</script>
</body>
</html>
it depends on what you are try to see
Sultan
@Sultan2790
Nov 06 2016 05:09
@Muktalgrg no of times dice rolled what does this mean ?
dice1 rolled : 3
dice2 rolled : 1
no of times dice rolled: 1
dice1 rolled : 2
dice2 rolled : 3
no of times dice rolled: 2
dice1 rolled : 3
dice2 rolled : 2
no of times dice rolled: 3
dice1 rolled : 3
dice2 rolled : 5
no of times dice rolled: 4
your expected sum is : 8
no of counts: 4
This is the output ! how come ?
Muktalgrg
@Muktalgrg
Nov 06 2016 05:12
output is the last one. above them is just showing the process. don't use document.write() for them. if you don't wanna show. @Sultan2790
Sultan
@Sultan2790
Nov 06 2016 05:14
so the program rolls until it get the number I entered right !
Marc M
@Marc-Moeller
Nov 06 2016 05:16
function nextInLine(arr, item) {
// Your code here
var testArr = [1,2,3,4,5];

testArr.push(6);

var removedFromtestArr;
removedFromtestArr = testArr.shift();

return testArr;  // Change this line
}

// Display Code
console.log("Before: " + JSON.stringify(testArr));

console.log(nextInLine(testArr)); // Modify this line to test

console.log("After: " + JSON.stringify(testArr));
console.log(nextInLine([], 1));
nextInLine([], 1) should return 1
inside the function testArr = 2,3,4,5,6
How do I make next inline 0,1 = 1 now? It's for the JS stand in line challenge
Muktalgrg
@Muktalgrg
Nov 06 2016 05:18
<html>
<body>
<script type = "text/JavaScript">

// Write a program that rolls a pair of dice until the sum of the numbers rolled is specific number.
// We also want to know the number of times the dice are rolled to get the desired sum.

var dice1, dice2, sum, count = 0; num;
var num = parseInt(prompt("Enter expected number(greater than 1 less than 13)."));

do{

dice1 = Math.floor((Math.random()*6)+1);
// document.write("<br> dice1 rolled : "+dice1);
dice2 = Math.floor((Math.random()*6)+1);
// document.write("<br> dice2 rolled : "+dice2);
sum = dice1 +dice2;
count++;
// document.write("<br> no of times dice rolled: "+count);
}while( sum !== num);

document.write("<br> your expected sum is : "+sum);
document.write("<br> no of counts: "+count);

</script>
</body>
</html>
you can do this
Walid Ashri
@walidashri
Nov 06 2016 05:19
@flyyyperth we use the function parameter arr not the testArr
Emily Sperry
@sperrye
Nov 06 2016 05:19
function largestOfFour(arr) {
var largestArray = [];
var largestNum;

for (var n = 0; n < arr.length; n++) {
for (var i = 0; i < arr[n].length; n++) {
arr.reduce(function(previousVal, currentVal) {
if (currentVal > previousVal) {
largestNum = currentVal;
largestNum.push(largestArray);
}
});
}
}
}
I'm getting Cannot read property 'length' of undefined, I've been working on this challenge for a couple of days I need some new direction.
Marc M
@Marc-Moeller
Nov 06 2016 05:19
@walidashri thanks, can you explain the difference please?
CamperBot
@camperbot
Nov 06 2016 05:19
flyyyperth sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 587 | @walidashri |http://www.freecodecamp.com/walidashri
Marc M
@Marc-Moeller
Nov 06 2016 05:22
function nextInLine(arr, item) {
// Your code here

arr.push(6);
arr.shift();

return item;  // Change this line
}

// Display Code
console.log("Before: " + JSON.stringify(testArr));

console.log(nextInLine(testArr)); // Modify this line to test

console.log("After: " + JSON.stringify(testArr));
console.log(nextInLine([2], 1));
Emily Sperry
@sperrye
Nov 06 2016 05:22
And why can't I make functions within a loop?
Marc M
@Marc-Moeller
Nov 06 2016 05:22
now console.log(nextInLine([2], 1)); gives me 1
how do I make it 2 ?
my array after: 2,3,4,5,6
Walid Ashri
@walidashri
Nov 06 2016 05:23
@flyyyperth function add(a,b){ return a+b} here a and b are called function parameters js treat them as defined variables u can use them in where inside the function and you can change its values when calling the function example
add(5,6)// returns 11
add(9,1) //returns 10 and so on
Joseph
@revisualize
Nov 06 2016 05:24
@flyyyperth You have a few issues.
Jeff
@horusofoz
Nov 06 2016 05:24
@flyyyperth return the shifted value rather than item
Joseph
@revisualize
Nov 06 2016 05:24
@flyyyperth One.. You're not adding item to the end of the array.
Muktalgrg
@Muktalgrg
Nov 06 2016 05:24

@flyyyperth

 arr.push(item);
item = arr.shift(arr);
return item;  // Change this line

did you do this?

Joseph
@revisualize
Nov 06 2016 05:24
@flyyyperth Two.. You're not returning the element that was removed.
@Muktalgrg Don't overwrite item.
Sultan
@Sultan2790
Nov 06 2016 05:24
@Muktalgrg Can we chat private plz ?
Joseph
@revisualize
Nov 06 2016 05:24
@Muktalgrg .shift() doesn't take an argument.
Sultan
@Sultan2790
Nov 06 2016 05:26
@Muktalgrg You the best :+1:
Joseph
@revisualize
Nov 06 2016 05:26
Getting in the habit of overwriting variable may be a bad habit to get into. And for this lesson, it isn't needed.
Jeff
@horusofoz
Nov 06 2016 05:26
Looking for help with Check for Palindromes exercise.
I've currently got:
function palindrome(str) {
// Good luck!
reversedStr = str.replace(/[^0-9a-z]/g, '').split('').reverse().join('').toLowerCase();

if (reversedStr === str)
{
return true;
}
return false;
}

palindrome("eye");
Sultan
@Sultan2790
Nov 06 2016 05:26
@Muktalgrg +1
@Muktalgrg :+1: :
Joseph
@revisualize
Nov 06 2016 05:26
@horusofoz You need to do the replace on both ends.
Jeff
@horusofoz
Nov 06 2016 05:27
@revisualize Can you elaborate mate?
Joseph
@revisualize
Nov 06 2016 05:27
@horusofoz reversedStr === str ... You need to do your replace on both ends of the evaluation.
Marc M
@Marc-Moeller
Nov 06 2016 05:27
@Muktalgrg and all others, many thanks for your help ! :)
CamperBot
@camperbot
Nov 06 2016 05:27
flyyyperth sends brownie points to @muktalgrg :sparkles: :thumbsup: :sparkles:
:cookie: 233 | @muktalgrg |http://www.freecodecamp.com/muktalgrg
Jeff
@horusofoz
Nov 06 2016 05:27
wait on the reverse as well as main str
Thank @revisualize :)
CamperBot
@camperbot
Nov 06 2016 05:27
horusofoz sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2247 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 06 2016 05:27
@horusofoz Yes.
@horusofoz Also. Look at your order of operations.
str.replace(/[^0-9a-z]/g, '').split('').reverse().join('').toLowerCase();
You go from left to right.
@horusofoz You're removing all uppercase characters.
Marc M
@Marc-Moeller
Nov 06 2016 05:28
arr.push(item); - does this add the number to the end of the array and stores the new array in a variable called ;'item' ?
Sultan
@Sultan2790
Nov 06 2016 05:28
@flyyyperth yes
Joseph
@revisualize
Nov 06 2016 05:28
@flyyyperth No.
Marc M
@Marc-Moeller
Nov 06 2016 05:29
^^
Joseph
@revisualize
Nov 06 2016 05:29
No.
Marc M
@Marc-Moeller
Nov 06 2016 05:29
No.
Joseph
@revisualize
Nov 06 2016 05:29
The answer to that question is NO.
Marc M
@Marc-Moeller
Nov 06 2016 05:29
(:
Is there an extended version available ?
Joseph
@revisualize
Nov 06 2016 05:30
@flyyyperth Let's break it down.
does this add the number to the end of the array ... YES
and stores the new array in a variable called ;'item' ? <--- NO.
Jeff
@horusofoz
Nov 06 2016 05:30
@revisualize Thanks again. Got there with:
function palindrome(str) {
// Good luck!
reversedStr = str.toLowerCase().replace(/[^0-9a-z]/g, '').split('').reverse().join('');

if (reversedStr === str.toLowerCase().replace(/[^0-9a-z]/g, ''))
{
return true;
}
return false;
}

palindrome("eye");
CamperBot
@camperbot
Nov 06 2016 05:30
horusofoz sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: horusofoz already gave revisualize points
Marc M
@Marc-Moeller
Nov 06 2016 05:30
cheers Joseph, what does the item part do for us ?\
Joseph
@revisualize
Nov 06 2016 05:30
@flyyyperth It is the number.
Sultan
@Sultan2790
Nov 06 2016 05:30
@Muktalgrg :+1:
Walid Ashri
@walidashri
Nov 06 2016 05:31
@sperrye u have a typo in 2nd for loop n++?
if u need to make a function in side loop create it outside then call it inside
Joseph
@revisualize
Nov 06 2016 05:31
@flyyyperth
// Write a function nextInLine which has two paramaters
// an array (arr) and a number (item).
function nextInLine(arr, item) { }
@flyyyperth You need to Add the number to the end of the array
Muktalgrg
@Muktalgrg
Nov 06 2016 05:32
@flyyyperth it just adds to the end.
var arr1 = [1];
arr1.push(2);
console.log(arr1); //outputs arr1[1,2]
Sultan
@Sultan2790
Nov 06 2016 05:33
@Muktalgrg How can I show the number dice1 and dice2 roll into to get the expected number ?
Marc M
@Marc-Moeller
Nov 06 2016 05:34
Okay, thanks @revisualize and Muktal
CamperBot
@camperbot
Nov 06 2016 05:34
flyyyperth sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2248 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 06 2016 05:35
@flyyyperth How are things? Did you figure it out?
Muktalgrg
@Muktalgrg
Nov 06 2016 05:35
@Sultan2790 sorry?, i think you just roll a dice. But can't predict the output. Its output is just random.
You can't make a dice roll this or that number using Math.random()
@flyyyperth hehe. i'm just a newbie. don't consider my answer seriously bro.
Sultan
@Sultan2790
Nov 06 2016 05:36
@Muktalgrg :+1:
Marc M
@Marc-Moeller
Nov 06 2016 05:36
@joseph when you say the number, any number?
Joseph
@revisualize
Nov 06 2016 05:37
@flyyyperth Do you understand parameters?
Emily Sperry
@sperrye
Nov 06 2016 05:37
thanks @walidashri
CamperBot
@camperbot
Nov 06 2016 05:37
sperrye sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 588 | @walidashri |http://www.freecodecamp.com/walidashri
Joseph
@revisualize
Nov 06 2016 05:38
@flyyyperth I didn't write the instructions. That text is from the instructions.
Marc M
@Marc-Moeller
Nov 06 2016 05:38
@revisualize I don't understand parameters
Joseph
@revisualize
Nov 06 2016 05:38

@flyyyperth Parameters are values that get passed into your function from the function call. You can use parameters like variables.
Example:

function hello(fName, uName) {
return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

@flyyyperth This example uses parameters that happen to be strings.
But, your parameters can be anything that you choose.
Sultan
@Sultan2790
Nov 06 2016 05:39
@Muktalgrg How can we show only if dices roll into specific numbers ? for example, if i enter 10, dice 1 should be 5 and dice2 5 .
Marc M
@Marc-Moeller
Nov 06 2016 05:40
Cool, I get that @revisualize . Merci
Joseph
@revisualize
Nov 06 2016 05:42
@flyyyperth Any other questions?
Marc M
@Marc-Moeller
Nov 06 2016 05:43
No that's it, many thanks for your great answers
Joseph
@revisualize
Nov 06 2016 05:43
@flyyyperth What does your function look like?
Sultan
@Sultan2790
Nov 06 2016 05:44
c0d0er
@c0d0er
Nov 06 2016 05:44
@0x0936 thanks
CamperBot
@camperbot
Nov 06 2016 05:44
c0d0er sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star2: 1814 | @0x0936 |http://www.freecodecamp.com/0x0936
Sultan
@Sultan2790
Nov 06 2016 05:44
When I enter 7 the program freeze
Marc M
@Marc-Moeller
Nov 06 2016 05:45

function nextInLine(arr, item) {

arr.push(item);
item = arr.shift(arr);
return item;

}
Joseph
@revisualize
Nov 06 2016 05:45
@flyyyperth A few things..
Marc M
@Marc-Moeller
Nov 06 2016 05:45
@revisualize that's the function for the stand in line challenge.
Joseph
@revisualize
Nov 06 2016 05:45
@flyyyperth Can you look at this code and tell me .. why would I do this?
Marc M
@Marc-Moeller
Nov 06 2016 05:46
I'd love to :)
Joseph
@revisualize
Nov 06 2016 05:46

@flyyyperth

function someStuff () {
var a = "Alpha";
var b = a;
var c = b;
return c;
}

Why would I do that? ... Couldn't I instead just return "Alpha"?

Ashish verma
@ashish1500616
Nov 06 2016 05:46
what does this syntax does :-str.replace(/[\W_]/g, '')
str.replace(/[\W]/g,'')
Joseph
@revisualize
Nov 06 2016 05:47
@bitian1506 What is \W?
Marc M
@Marc-Moeller
Nov 06 2016 05:47
You are passing the 'Alpha' string from var a to b to c and then returning it hmm @revisualize not sure
Joseph
@revisualize
Nov 06 2016 05:47
@flyyyperth Doesn't it seem kind of pointless?
Marc M
@Marc-Moeller
Nov 06 2016 05:48
Do you use 'c' as a parameter somewhere else later in another piece of code?
agreed, pointless :D
Joseph
@revisualize
Nov 06 2016 05:48
@flyyyperth That's all the code.
@flyyyperth So, why overwrite a variable to just return the variable?
Why not just return the thing?
Marc M
@Marc-Moeller
Nov 06 2016 05:49
to prove that you can do pointless things in JS ?
Joseph
@revisualize
Nov 06 2016 05:49
Okay.
@flyyyperth Also. .shift() doesn't take an argument.
Ashish verma
@ashish1500616
Nov 06 2016 05:49
function palindrome(str) {
return str.replace(/[\W]/g, '').toLowerCase() ===
str.replace(/[\W
]/g, '').toLowerCase().split('').reverse().join('');
}
Joseph
@revisualize
Nov 06 2016 05:49
@bitian1506 Doesn't change my question. What is \W?
Ashish verma
@ashish1500616
Nov 06 2016 05:50
this is the code i m trying to figure out how that replacemethod works ,srry @joseph that i dont know
i came across this code while searching for pailandrome code.
Joseph
@revisualize
Nov 06 2016 05:53
Marc M
@Marc-Moeller
Nov 06 2016 05:53
@revisualize How come the challenge accepted item = arr.shift(arr); when you are saying shift does not take an argument
Joseph
@revisualize
Nov 06 2016 05:54
@flyyyperth An argument is a value (primitive or object) passed as input to a function.
@flyyyperth arr.shift();
Marc M
@Marc-Moeller
Nov 06 2016 05:55
Right, I shall read through that. thanks
Ashish verma
@ashish1500616
Nov 06 2016 05:56
Joseph
@revisualize
Nov 06 2016 05:57
@bitian1506 That is \w .. What does \W do?
@bitian1506 I'm not asking for you send me off to links. If you send me a link... I don't really know if you understand what it does.
@bitian1506 For me to help you.. I need to know that you understand some concepts.
Joseph
@revisualize
Nov 06 2016 06:03
la la la la
Anyone else need help with anything?
Ashish verma
@ashish1500616
Nov 06 2016 06:07
I dont know dude,thts why I am seeking for som1s help @revisualize
Oniichan
@ProjectOU
Nov 06 2016 06:09

http://otakunity.ml/

"Contribute to the development of Otakunity!"

Joseph
@revisualize
Nov 06 2016 06:09
@bitian1506 \W ... Matches any non-word character. Equivalent to [^A-Za-z0-9_].
Ashish verma
@ashish1500616
Nov 06 2016 06:10
thanks @joseph what is the difference between \w & \W
CamperBot
@camperbot
Nov 06 2016 06:10
bitian1506 sends brownie points to @joseph :sparkles: :thumbsup: :sparkles:
:cookie: 32 | @joseph |http://www.freecodecamp.com/joseph
Ashish verma
@ashish1500616
Nov 06 2016 06:10
thanks @revisualize what is the difference between \w & \W??
CamperBot
@camperbot
Nov 06 2016 06:10
bitian1506 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2249 | @revisualize |http://www.freecodecamp.com/revisualize
Greg Duncan
@GregatGit
Nov 06 2016 06:11
\w Find a word character
\W Find a non-word character
Prateek Gogia
@reeversedev
Nov 06 2016 06:11
Anyone done with Counting Cards challenge?
Joseph
@revisualize
Nov 06 2016 06:11
@bitian1506 \w
Matches any alphanumeric character including the underscore. Equivalent to [A-Za-z0-9_].
Ashish verma
@ashish1500616
Nov 06 2016 06:11
ok thanks what does putting a underscore after \W_ means
??
Joseph
@revisualize
Nov 06 2016 06:12
@bitian1506 everything from \W plus _
Muktalgrg
@Muktalgrg
Nov 06 2016 06:12
@Sultan2790 program freezes because a dice don't have value greater than 6 and less than 1 . you did Math.random(....)*6 +1 to me maximum number of 6
Ashish verma
@ashish1500616
Nov 06 2016 06:13
\W means every characters from \w including
_ (underscore ) m i correct"??
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:14
@ProjectOU This is not an advertising platform. Please do NOT advertise here. :warning: Please read and abide by FreeCodeCamp Code of Conduct
Joseph
@revisualize
Nov 06 2016 06:14
@bitian1506 \W and \w are opposite
Muktalgrg
@Muktalgrg
Nov 06 2016 06:15
@Sultan2790 omg. is it really 12.44am there ?? Its 12.01 pm here
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:16
We're around 10 mins apart @Muktalgrg
It's 11:46 AM here
Sultan
@Sultan2790
Nov 06 2016 06:20
@Muktalgrg yes hahahaha time is crazy
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:21
We're not in a frame of time. Rather we're in a frame of Time-Space continuum. Weird and Crazy
Sultan
@Sultan2790
Nov 06 2016 06:21
@Muktalgrg so the users should only enter even numbers ? like 4, 6, 8, 10, 12
@Muktalgrg I think this would work tho
Muktalgrg
@Muktalgrg
Nov 06 2016 06:23
@Sultan2790 dice has face =1,2,3,4,5,6. when two dice are rolled. numbers will be greater than 1 less than 13
Joseph
@revisualize
Nov 06 2016 06:25
Not all dice have six sides
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:25
huh?
we shouldn't play unstable dice
Puspak
@Puspak64
Nov 06 2016 06:26

Friends I am solving a problem but i am not able to understand how to start it. Any kind of help would be great. The problem statement is below.

Milly likes to solve problems very much. Today she is solving a problem in which she has N, L and R and she has to find out the total count of Magic Numbers in [L, R] . Magic Numbers are the numbers which are divisible by at least one prime number in [1, N] . Being a beginner in programming, this one seems too hard for her to solve. So, she is asking you for her help, so your task is to solve this problem.
Input:
First line of the input will have a integer T(number of test cases). Then each of the next T lines will contain 3 space separated integers: N, L and R.
Output:
For each test case, print a single line having the count of Magic Numbers in [L, R] .
Constraints
1 ≤ T ≤ 10
2 ≤ N ≤ 50
1 ≤ L ≤ R ≤ 10^18

Joseph
@revisualize
Nov 06 2016 06:27
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:27
Everything seems unstable except the 6 faced one
;P
Sultan
@Sultan2790
Nov 06 2016 06:27
@Muktalgrg Okay I get it .... Thanks for all your time
CamperBot
@camperbot
Nov 06 2016 06:27
sultan2790 sends brownie points to @muktalgrg :sparkles: :thumbsup: :sparkles:
:cookie: 234 | @muktalgrg |http://www.freecodecamp.com/muktalgrg
Joseph
@revisualize
Nov 06 2016 06:28
They're not. I have 3 bags full of them.
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:28
@Puspak64 Who is solving the problem? You or Milly? ;P
Nathan
@terakilobyte
Nov 06 2016 06:28
@revisualize yo
Joseph
@revisualize
Nov 06 2016 06:28
Yo.
Abhisek Pattnaik
@abhisekp
Nov 06 2016 06:28
Wow!
Nathan
@terakilobyte
Nov 06 2016 06:28
@revisualize I sent you an invite on skype
anyway, pm inc
Joseph
@revisualize
Nov 06 2016 06:29
okay.
Muktalgrg
@Muktalgrg
Nov 06 2016 06:30
@Sultan2790 glad that it helped
c0d0er
@c0d0er
Nov 06 2016 06:30
does anybody know why my .timer div include work and break 4 small buttons even timer div is behind the work and break buttons? code is very short, thanks, http://codepen.io/c0d0er/pen/eBmgQP?editors=1010
Sultan
@Sultan2790
Nov 06 2016 06:30
@Muktalgrg Yes I was almost getting the work but I missed my conditions up hahahah. You Pro . Thanks for all your help
CamperBot
@camperbot
Nov 06 2016 06:30
sultan2790 sends brownie points to @muktalgrg :sparkles: :thumbsup: :sparkles:
:warning: sultan2790 already gave muktalgrg points
Sultan
@Sultan2790
Nov 06 2016 06:32
@ProjectOU Thanks for all your help
CamperBot
@camperbot
Nov 06 2016 06:32
sultan2790 sends brownie points to @projectou :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for projectou
Oniichan
@ProjectOU
Nov 06 2016 06:36
No problem bro :)
Muktalgrg
@Muktalgrg
Nov 06 2016 06:37
when should i use .forEach and .reduce. seems like both of them give same output
var array = [4,5,6,7,8];
var singleVal = 0;

// Only change code below this line.
//...........process 1
var array = array.reduce(function(previous, current){
return previous+current;
},0);
singleVal = array;

//.......... process 2
var array = array.forEach(function(x){
singleVal +=x;
});
Joseph
@revisualize
Nov 06 2016 06:38
@Muktalgrg .reduce() is more powerful than .forEach()
Muktalgrg
@Muktalgrg
Nov 06 2016 06:44
@revisualize both of them looks same to me
Joseph
@revisualize
Nov 06 2016 06:48
@Muktalgrg They aren't.
@Muktalgrg Just because you're currently doing something with them that makes them look similar. Doesn't make them the same.
@Muktalgrg It would be like comparing a pickup truck to a smart car. If you only use the vehicle to drive from point a to point b. They do the same thing. But, a pickup truck is in a class of it's own when you want to do heavy tasks.
@Muktalgrg And you can really see that from this picture: http://blog.thenewstribune.com/politics/files/2011/03/Smart-Truck.jpg
Muktalgrg
@Muktalgrg
Nov 06 2016 06:52
@revisualize haha. Thanks
CamperBot
@camperbot
Nov 06 2016 06:52
muktalgrg sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2251 | @revisualize |http://www.freecodecamp.com/revisualize
Oniichan
@ProjectOU
Nov 06 2016 06:53
+=
Johnny
@JohnnyBizzel
Nov 06 2016 06:58
@revisualize Why is reduce more powerful that forEach boss?
Joseph
@revisualize
Nov 06 2016 06:59
I guess it is just different functionality.
I was specifically told a long time ago that you can use .reduce() to do the same functionality of .forEach(), .map() and .filter()
Jose Antonio Rivas
@joseantonio
Nov 06 2016 07:03
@revisualize thank you so much, this helped me too.
CamperBot
@camperbot
Nov 06 2016 07:03
joriancode sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2252 | @revisualize |http://www.freecodecamp.com/revisualize
Muktalgrg
@Muktalgrg
Nov 06 2016 07:12
@revisualize found the answer that .forEach() just iterates through the numbers in an array but it returns nothing
Prateek Gogia
@reeversedev
Nov 06 2016 07:12
@JohnnyBizzel Need help bro!
Johnny
@JohnnyBizzel
Nov 06 2016 07:13
@reeversedev Do I? What did I do?
Prateek Gogia
@reeversedev
Nov 06 2016 07:13
I am doing "Using Objects for Lookups" challenge.
I am unable to get results
Johnny
@JohnnyBizzel
Nov 06 2016 07:14
@reeversedev Show us some code
Prateek Gogia
@reeversedev
Nov 06 2016 07:14

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
val = {
bravo:"Boston",
charlie:"Chicago",
delta:"Denver",
echo:"Easy",
foxtrot:"Frank"
};

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");

Johnny
@JohnnyBizzel
Nov 06 2016 07:16
@revisualize Regarding reduce() , I don't like the MDN terms previous, current ... function(previous, current)
Better terminology is (eg) function(accumulatedTotal, nextItem)
'''
CamperBot
@camperbot
Nov 06 2016 07:16
:bulb: to format code use backticks!  more info
Johnny
@JohnnyBizzel
Nov 06 2016 07:16
@reeversedev You need to put something to result
Muktalgrg
@Muktalgrg
Nov 06 2016 07:17
@reeversedev include
result =lookup[val];
return result;
Prateek Gogia
@reeversedev
Nov 06 2016 07:17
@JohnnyBizzel I tried it.
No success yet!
Muktalgrg
@Muktalgrg
Nov 06 2016 07:18

@reeversedev


// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
bravo : "Boston",
charlie : "Chicago",
delta : "Denver",
echo : "Easy",
foxtrot : "Frank"
};
result =lookup[val];

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");// chicago

here is the full code

Joseph
@revisualize
Nov 06 2016 07:19
@reeversedev Your function has declared and initialized the variable result to "". You are not modifying result and your function is returning result. Ergo, you're returning "". You need to modify result to be the value of the property from the object that you created.
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:19
Hi! trying to convert celsius to Fahrenheit and a little stuck , can someone help me import the formula? 9/5 plus 32?
Joseph
@revisualize
Nov 06 2016 07:19
Or someone can just give you the answer.
Johnny
@JohnnyBizzel
Nov 06 2016 07:19
Lol. We're here to learn/copy/paste.
Joseph
@revisualize
Nov 06 2016 07:19
meh.
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:20
who me? nah just trying to convert 22 celsius into fh
Muktalgrg
@Muktalgrg
Nov 06 2016 07:21
@revisualize sorry for that. but this is not hard to understand. thought he had typed something mistakely
Joseph
@revisualize
Nov 06 2016 07:21
@Sharifdesigns22 What is the non-programming ... Just math ... process for converting celsius to fahrenheit ?
@Muktalgrg What you may find easy others may find extremely difficult.
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:22
@revisualize deduct 32, x5, /9?
Johnny
@JohnnyBizzel
Nov 06 2016 07:22
@Sharifdesigns22 How would you do it with a calculator?
Clu: 28 C = 82 F
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:23
-32(5)(/9)
Joseph
@revisualize
Nov 06 2016 07:24
@Sharifdesigns22 that isn't correct.
Fahrenheit is the "temperature in Celsius" times 9/5 plus 32
Johnny
@JohnnyBizzel
Nov 06 2016 07:25
0 deg C = 32 deg F
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:25
Gotcha that makes sense @JohnnyBizzel
Johnny
@JohnnyBizzel
Nov 06 2016 07:26
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:26
• @revisualize
Ahh ok. Im eternally grateful thanks for you help

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
convertToF(0) 9=/5 + 32;

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(0);

Joseph
@revisualize
Nov 06 2016 07:29
@Sharifdesigns22 convertToF is a function.
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:29
Take out the function then?
@revisualize
Johnny
@JohnnyBizzel
Nov 06 2016 07:31
@Sharifdesigns22 You have made a recursive function! Cool, but not in this case!!
Use the variables you are given.
@Sharifdesigns22 Do you know how function parameters work?
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:33
I dont unfortunately
@JohnnyBizzel
Joseph
@revisualize
Nov 06 2016 07:34

Parameters are values that get passed into your function from the function call. You can use parameters like variables.
Example:

function hello(fName, uName) {
return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

Johnny
@JohnnyBizzel
Nov 06 2016 07:34
function [someFunctionName] ( [someParameter] ) <- these can be any number of
It means you can pass in a value to the function making the code re-usable.
RakeshNerkar
@Rakesh18754
Nov 06 2016 07:35
Any one knows any IDE which provides localhost like webstorm ???
but is free to use unlike webstorm?
Johnny
@JohnnyBizzel
Nov 06 2016 07:35
@Sharifdesigns22 You need to watch this:
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:36
@JohnnyBizzel @revisualize Okay so ignore the functions for now and use parameters, ok i'll watch that first
Johnny
@JohnnyBizzel
Nov 06 2016 07:36
@Sharifdesigns22 Note I have fast forwarded to the good bit! Or you should go to 4 mins in.
__SharifTarver__
@Sharifdesigns22
Nov 06 2016 07:38
@JohnnyBizzel couldn't hurt to start from the beginning! and thanks
CamperBot
@camperbot
Nov 06 2016 07:38
sharifdesigns22 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 761 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Nov 06 2016 07:38
@Rakesh18754 What is webstorm?
@Sharifdesigns22 Why not ^_^
Joseph
@revisualize
Nov 06 2016 07:39
@JohnnyBizzel Except he's using the incorrect terminology.
He keeps saying "arguments" when they are parameters
Johnny
@JohnnyBizzel
Nov 06 2016 07:40
@revisualize But it should give the general idea of a function :worried: ??
Joseph
@revisualize
Nov 06 2016 07:40
It should.
But, damn.
Prateek Gogia
@reeversedev
Nov 06 2016 07:41
Thanks @Muktalgrg @JohnnyBizzel
CamperBot
@camperbot
Nov 06 2016 07:41
reeversedev sends brownie points to @muktalgrg and @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 762 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
:cookie: 236 | @muktalgrg |http://www.freecodecamp.com/muktalgrg
Johnny
@JohnnyBizzel
Nov 06 2016 07:41
@reeversedev :+1:
Joseph
@revisualize
Nov 06 2016 07:44
I wonder how many people are using the incorrect terminology because of this video.
Johnny
@JohnnyBizzel
Nov 06 2016 07:45
@revisualize what did he do wrong?
Joseph
@revisualize
Nov 06 2016 07:45
I'll show you..
function add (firstNum, secondNum) { // Here, firstNum and secondNum are not arguments. They are parameters.
return firstNum + secondNum;
}
add(10, 5); // These are arguments. The arguments of 10 and 5.
// The first argument passed becomes the first parameter.
// The second argument passed becomes the second parameter.
@JohnnyBizzel He keeps calling parameters arguments.
Johnny
@JohnnyBizzel
Nov 06 2016 07:50
@revisualize Yes I did wonder why he was calling them arguments. Not a biggy though.
Joseph
@revisualize
Nov 06 2016 07:51
Johnny
@JohnnyBizzel
Nov 06 2016 07:51
@revisualize Maybe we need to do our own video on functions! :P
silver537
@silver537
Nov 06 2016 07:51
#hedoesn'tfullyknowwhatheistalkingabout
Stoica Valentin
@stoicavali91
Nov 06 2016 07:52
hi guys, i am at the Seek and Destroy challenge and i don't really understand Arguments. Can someone help me?
Joseph
@revisualize
Nov 06 2016 07:52
@JohnnyBizzel I've actually been thinking about doing a set of videos on Basic JavaScript from start to finish with extra instruction included.
Johnny
@JohnnyBizzel
Nov 06 2016 07:52
@revisualize Amen to that! :+1:
Joseph
@revisualize
Nov 06 2016 07:52
@stoicavali91 Good thing we were just talking about that.
Johnny
@JohnnyBizzel
Nov 06 2016 07:53
@revisualize I like Derek Banas but he's quite fast for beginners.
He provides the code he talks about:
http://www.newthinktank.com/2015/09/learn-javascript-one-video/
Joseph
@revisualize
Nov 06 2016 07:55
watchandcode.com is really good for beginners
Johnny
@JohnnyBizzel
Nov 06 2016 08:01
@revisualize Noted, thanks :)
CamperBot
@camperbot
Nov 06 2016 08:01
johnnybizzel sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2253 | @revisualize |http://www.freecodecamp.com/revisualize
MM Nauman
@mmnauman
Nov 06 2016 08:22

Hello need help in this challenge In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

Oniichan
@ProjectOU
Nov 06 2016 08:30
function sendlike(){
var text = $( ".likeajax" ).length; var text2 = ""; var i; for (i = 0; i < text; i++) { var other_data =$('.likeajax')[i];
var fd = new FormData(other_data);
$.ajax({ url: 'includes/like.php', data: fd, contentType: false, processData: false, type: 'POST', success: function(data){ console.log(data); } }); } } can i produce individual output? every heart button is on zero but when i click one of them everyone is affected Ghulam Shabir @ghulamshabir Nov 06 2016 08:42 @mmnauman the Instructions are clear, what don't you understand ? @stoicavali91 every function has an arguments object which has the function's arguments, you can access first argument for example like this, arguments[0], like arrays it will give you the function's the first argument Stoica Valentin @stoicavali91 Nov 06 2016 08:50 @ghulamshabir Thank you CamperBot @camperbot Nov 06 2016 08:50 stoicavali91 sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles: :cookie: 860 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir Ida Bagus Chahya Dhegana @dgana Nov 06 2016 08:50 I need help on local scope and functions please thank you it says No global myVar variable Ghulam Shabir @ghulamshabir Nov 06 2016 08:50 @dgana post your code here copy paste it Ida Bagus Chahya Dhegana @dgana Nov 06 2016 08:51 function myLocalScope() { var myVar = 'use strict'; console.log(myVar); } myLocalScope(); // Run and check the console // myVar is not defined outside of myLocalScope console.log(myVar); // Now remove the console log line to pass the test Ghulam Shabir @ghulamshabir Nov 06 2016 08:52 @dgana first of all do not assign use strict to myvar, use strict should be alone and first line of the function, its just like a directive to tell js engine not to be stupid @dgana after 'use strict', you create variable myVar not myvar Ida Bagus Chahya Dhegana @dgana Nov 06 2016 08:54 ok Ghulam Shabir @ghulamshabir Nov 06 2016 08:54 @dgana myVar should be assigned any string you want even your name Ida Bagus Chahya Dhegana @dgana Nov 06 2016 08:56 it still telling me no global myVar variable Ghulam Shabir @ghulamshabir Nov 06 2016 08:57 @dgana remove consol.log at last line Ida Bagus Chahya Dhegana @dgana Nov 06 2016 08:58 @ghulamshabir outside the function right? delete all? Ghulam Shabir @ghulamshabir Nov 06 2016 08:58 @dgana yes out side of function, only remove console.log(myVar), or just comment it out using // Ida Bagus Chahya Dhegana @dgana Nov 06 2016 08:59 function myLocalScope() { 'use strict'; var myVar = 'dgana'; console.log(myVar); } myLocalScope(); // Run and check the console // myVar is not defined outside of myLocalScope //console.log(myVar); // Now remove the console log line to pass the test did I do something wrong? Ghulam Shabir @ghulamshabir Nov 06 2016 08:59 @dgana if still not passing then refresh your browser Ida Bagus Chahya Dhegana @dgana Nov 06 2016 09:00 yesss thank you @ghulamshabir ! CamperBot @camperbot Nov 06 2016 09:00 dgana sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles: :cookie: 861 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir Ghulam Shabir @ghulamshabir Nov 06 2016 09:00 @dgana :smile: MM Nauman @mmnauman Nov 06 2016 09:04 @ghulamshabir I'm not understanding this two lines Add the number to the end of the array, then remove the first element of array Ghulam Shabir @ghulamshabir Nov 06 2016 09:05 @mmnauman could you recall the functions adding to end and removing from front of array ? MM Nauman @mmnauman Nov 06 2016 09:05 @ghulamshabir like pop(), shift etc Ghulam Shabir @ghulamshabir Nov 06 2016 09:06 @mmnauman these functions only remove you need one of them to remove but which one ? LupusDiamond @LupusDiamond Nov 06 2016 09:07 Hey guys, once again I need your help Ghulam Shabir @ghulamshabir Nov 06 2016 09:07 @mmnauman and you also need a function to add a value to end of array, could you recall the function ? LupusDiamond @LupusDiamond Nov 06 2016 09:07 I'm at the "Using Objects for Lookups" part // Setup function phoneticLookup(val) { var result = ""; // Only change code below this line result = { alpha : "Adams", bravo : "Boston", charlie : "Chicaco", delta : "Denver", echo : "Easy", foxtrot : "Frank" }; // Only change code above this line return result; } // Change this value to test phoneticLookup("charlie"); here is my code MM Nauman @mmnauman Nov 06 2016 09:07 @ghulamshabir push() function? Ghulam Shabir @ghulamshabir Nov 06 2016 09:08 @mmnauman yes use push to add item to end of arr Markus Kiili @Masd925 Nov 06 2016 09:08 @LupusDiamond Don't touch the lookup object. Just access the object with syntax obj[key] and assign it to result MM Nauman @mmnauman Nov 06 2016 09:09 But I'm not to use this functions correctly. I need to add a number to the end of the array but which array arr ? Ghulam Shabir @ghulamshabir Nov 06 2016 09:10 @mmnauman yes the array arr Markus Kiili @Masd925 Nov 06 2016 09:10 @mmnauman arr is a function parameter. It holds the passed array when a function call is executed. MM Nauman @mmnauman Nov 06 2016 09:12 @Masd925 so if want to hold the passed array in my custom code so I should mandatory use arr or I can use any name LupusDiamond @LupusDiamond Nov 06 2016 09:13 I still dont get it @Masd925 MM Nauman @mmnauman Nov 06 2016 09:13 @ghulamshabir Now I have added the last number now I need to return arr ? Markus Kiili @Masd925 Nov 06 2016 09:13 @mmnauman Those parameter names are just some descriptive names. Could be almost anything. On challenges, you should not change the function or parameter names. LupusDiamond @LupusDiamond Nov 06 2016 09:14 nvm fixed it Ghulam Shabir @ghulamshabir Nov 06 2016 09:14 @mmnauman no, you need to remove the first element from arr, and return that removed element LupusDiamond @LupusDiamond Nov 06 2016 09:14 ty @Masd925 anyways CamperBot @camperbot Nov 06 2016 09:14 lupusdiamond sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles: :star2: 2846 | @masd925 |http://www.freecodecamp.com/masd925 MM Nauman @mmnauman Nov 06 2016 09:15 @ghulamshabir ok after removing the first element how to return that removed element? Ghulam Shabir @ghulamshabir Nov 06 2016 09:16 @mmnauman you either do this var removed = arr.shift(); return removed or return arr.shift() MM Nauman @mmnauman Nov 06 2016 09:17 @ghulamshabir ok thanks now got it. CamperBot @camperbot Nov 06 2016 09:17 mmnauman sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles: :cookie: 862 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir Jerusalems @simida0852 Nov 06 2016 09:17 // Setup var myStr = "Jello World"; myStr = "Hello World"; // Only change code below this line myStr[0] = "H"; // Fix Me Write that right? Ghulam Shabir @ghulamshabir Nov 06 2016 09:18 @mmnauman :+1: @simida0852 strings are immuatable, but you can replace entire string with new value Joseph @revisualize Nov 06 2016 09:20 @ghulamshabir I really do think that we shouldn't be telling people to set a variable to just return the variable. But, I'm just a guy with an opinion. Oniichan @ProjectOU Nov 06 2016 09:22 guys please helpme :( Joseph @revisualize Nov 06 2016 09:22 With? Ghulam Shabir @ghulamshabir Nov 06 2016 09:22 @revisualize they are beginners, they should know what options they have , and how the things work Oniichan @ProjectOU Nov 06 2016 09:22 $(document).ready(function(){
$(".social").click(function() { sendlike(); }); }); function sendlike(){ var other_data =$('.likeajax')[1];
var fd = new FormData(other_data);
$.ajax({ url: 'includes/like.php', data: fd, contentType: false, processData: false, type: 'POST', success: function(data){ console.log(data); } }); } Joseph @revisualize Nov 06 2016 09:23 @ProjectOU Which FreeCodeCamp.com lesson is that? Markus Kiili @Masd925 Nov 06 2016 09:23 @revisualize Some people understand it better with the extra variable, but one should also mention that it is redundant. Johnny @JohnnyBizzel Nov 06 2016 09:23 @ProjectOU Nice graphics! :D Joseph @revisualize Nov 06 2016 09:23 I'm going to bed. Meh. Oniichan @ProjectOU Nov 06 2016 09:23 Output Button1 = Data1 Button2 = Data1 Need Output Button1 = Data1 Button2 = Data2 @JohnnyBizzel Thanks :) CamperBot @camperbot Nov 06 2016 09:24 projectou sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles: :cookie: 763 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel MM Nauman @mmnauman Nov 06 2016 09:25 @ghulamshabir Now I did everything correctly but still the last after part is not getting solved can you give an example Ghulam Shabir @ghulamshabir Nov 06 2016 09:26 @mmnauman which one shift ? MM Nauman @mmnauman Nov 06 2016 09:28 function nextInLine(arr, item) { // Yournee code here arr = [1,2,3,4,5]; arr.push(7); var nowRemoved = arr.shift(); return nowRemoved; // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 4)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); Johnny @JohnnyBizzel Nov 06 2016 09:29 @ProjectOU I would target with an Id rather than a class Ghulam Shabir @ghulamshabir Nov 06 2016 09:29 @mmnauman you should push item not 7 Oniichan @ProjectOU Nov 06 2016 09:30 @JohnnyBizzel for the click function? MM Nauman @mmnauman Nov 06 2016 09:30 @ghulamshabir the parameter? Ghulam Shabir @ghulamshabir Nov 06 2016 09:30 @mmnauman yes Johnny @JohnnyBizzel Nov 06 2016 09:30 @mmnauman How functions work: (note he calls parameters arguments sometimes!!) https://www.youtube.com/watch?v=AY6X5jZZ_JE&start=257 MM Nauman @mmnauman Nov 06 2016 09:32 @ghulamshabir still the challenge is not solved after using item parameter @JohnnyBizzel thanks I will watch it CamperBot @camperbot Nov 06 2016 09:34 mmnauman sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles: :cookie: 764 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel Ghulam Shabir @ghulamshabir Nov 06 2016 09:34 @JohnnyBizzel @mmnauman function add(arr, item) { arr.push(item) } here arr, item are called parameters and add([1,2,3], 6), here literal values are arguments Oniichan @ProjectOU Nov 06 2016 09:35 @JohnnyBizzel function sendlike(){ var text =$( ".likeajax" ).length;
var text2 = "";
var i;
for (i = 0; i < text; i++) {
var other_data = $('.likeajax')[i]; var fd = new FormData(other_data);$.ajax({
url: 'includes/like.php',
data: fd,
contentType: false,
processData: false,
type: 'POST',
success: function(data){
console.log(data);
}
});
}

}
how can i produce single outputs
Ghulam Shabir
@ghulamshabir
Nov 06 2016 09:36
@mmnauman shoud not reset arr = [1, 2, 3], remove that line
Johnny
@JohnnyBizzel
Nov 06 2016 09:36
@ghulamshabir Thanks for explaining :+1:
CamperBot
@camperbot
Nov 06 2016 09:36
johnnybizzel sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:cookie: 863 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ghulam Shabir
@ghulamshabir
Nov 06 2016 09:37
@JohnnyBizzel :+1:
MM Nauman
@mmnauman
Nov 06 2016 09:39
@ghulamshabir sorry for troubling. finally now I got it after your clear explanation
Ghulam Shabir
@ghulamshabir
Nov 06 2016 09:39
@mmnauman :+1:
Erick Delfin
@Nifled
Nov 06 2016 09:40
When your on a website on a mobile device, what exactly happens when, lets say you click on an input label, and the keyboard pops up? Does it alter window size like the width or something?
Johnny
@JohnnyBizzel
Nov 06 2016 09:41
@ProjectOU You need to create unique IDs and set them in the DOM. You are using class level selectors at the moment: $(".social") Not sure if this is the problem but I believe this is likely. Erick Delfin @Nifled Nov 06 2016 09:42 If anyone can explain this, please. Jeff Shapiro @Jeff-Shapiro Nov 06 2016 09:45 @Nifled depends what you tell it to do Erick Delfin @Nifled Nov 06 2016 09:48 @Jeff-Shapiro I want to know what the behavior is by default. Jeff Shapiro @Jeff-Shapiro Nov 06 2016 09:48 different per operating system Erick Delfin @Nifled Nov 06 2016 09:49 ok lol, lets just say I'm on Android Samiullah Khan @technbuzz Nov 06 2016 09:52 Hey everybody need help in finding LCM of numbers in Range Erick Delfin @Nifled Nov 06 2016 09:55 great, thanks Dany @Danylrs Nov 06 2016 09:55 good morning campers Zcholicc @Zcholicc Nov 06 2016 09:57 I cant figure out Chunky Monkey Dany @Danylrs Nov 06 2016 09:57 I'm working on the lesson "escape sequences in strings" and cant seem to get one thing checked off in the instructions. Not sure whats wrong with my code. Is anyone here up to this lesson that can help? Zcholicc @Zcholicc Nov 06 2016 09:57 function chunk(arr, size) { // Break it up. b=[]; for(i=0;i<arr.length;i+=size){ b.push(arr.slice(i,size)); } return b; } These codes don't work . Dany @Danylrs Nov 06 2016 09:59 nevermind campers, I just found out the solution. it was just spacing, lol... smh! mj-e @mj-e Nov 06 2016 10:18 Hi this code is working correctly can anyone see an issue with it? Its not passing the test. Its just a string repeat function function repeat(str, num) { if (num > 0){ str = '"' + str.repeat(num) + '"'; return str; } if (num <= 0){ return'""'; } } repeat("abc", 3); Ian @toianw Nov 06 2016 10:26 @mj-e you've got double quotes inside your string. @Zcholicc what happens when i becomes bigger than size? Philipp Scholz @philipp32 Nov 06 2016 10:40 Hey friends, I have trouble understanding this algorithm. var arr = [10,9,8,7,6]; for (var i=0; i < arr.length; i++) { console.log(arr[i]); } 1. What does the i<arr.length do? 1. What does the arr[i] statement do? I understand it like this. As long as i is smaller than the length of the array, i will be increased by one. Then the console.log statement will give out the i-th position of the array. Is that true? @Lumexralph thanks CamperBot @camperbot Nov 06 2016 10:44 philipp32 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles: :cookie: 412 | @lumexralph |http://www.freecodecamp.com/lumexralph Deepak Sharma @Deeps-1989 Nov 06 2016 11:05 hi guys nickzasa @nickzasa Nov 06 2016 11:06 Hey guys I am stuck on the challenege truncate a string. my code is as follows pleasecan someone advise me on what I am doing wrong. ''' function truncateString(str, num) { var temp; var max; var chop; var length; length = str.length; max = num; if(max<=3){ max = length-num; }else{ max = length-num-3; } var final; chop = max-length; final = str.slice(chop); return final; }''' CamperBot @camperbot Nov 06 2016 11:06 :bulb: to format code use backticks!  more info nickzasa @nickzasa Nov 06 2016 11:07 function truncateString(str, num) { var temp; var max; var chop; var length; length = str.length; max = num; if(max<=3){ max = length-num; }else{ max = length-num-3; } var final; chop = max-length; final = str.slice(chop); return final; } Deepak Sharma @Deeps-1989 Nov 06 2016 11:13 what does num indicate?? can u tell what r u trying to achieve? Kodemar Gaurav Thantry @gauravthantry Nov 06 2016 11:16 function confirmEnding(str, target) { var arr=[]; var arr1=[]; var m=0; if(target.length===1){ arr = str.split(""); if(arr[arr.length-1]===target) return true; else if(arr[arr.length-1]!==target) return false; } else if(target.length>1){ arr = str.split(" "); if(arr[arr.length-1]===target) return true; else if(arr[arr.length-1]!==target) return false; } var string=arr[arr.length-1]; for(i=0;i<string.length;i++){ if(string.substr(i,string.length-1)===target) return true; m = 1;} if(m===0) return false; } confirmEnding("Bastian", "n"); can anyone help me out here? most of the code is correct, I'm only not able to check if the substring of the last string of the array matches with the compared string. confirmEnding("Open sesame", "same") for this case the above condition should also return true vishugosain @vishugosain Nov 06 2016 11:23 Anybody has the solution to record collection ? in javascript heroiczero @heroiczero Nov 06 2016 11:25 @vishugosain do u want the solution? vishugosain @vishugosain Nov 06 2016 11:25 @heroiczero Yes heroiczero @heroiczero Nov 06 2016 11:25 @vishugosain or help? vishugosain @vishugosain Nov 06 2016 11:26 i need the solution heroiczero @heroiczero Nov 06 2016 11:26 function updateRecords(id, prop, value) { if(value === ""){ delete collection[id][prop]; } else if (prop === "tracks" && collection[id].hasOwnProperty(prop)) { collection[id][prop][collection[id][prop].length]=value; } else if (prop === "tracks"){ collection[id][prop]=[]; collection[id][prop][0]=value; } else{ collection[id][prop]=value; } return collection; } @vishugosain anyways thats my solution i have laravelblade @laravelblade Nov 06 2016 11:26 How do add default layout to my website, for example my website will have an upload feature where users can upload products, how do i , so that when a user uploads it shows in a default theme and not any ordinary html? vishugosain @vishugosain Nov 06 2016 11:27 Thanx @heroiczero CamperBot @camperbot Nov 06 2016 11:27 vishugosain sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles: :cookie: 351 | @heroiczero |http://www.freecodecamp.com/heroiczero laravelblade @laravelblade Nov 06 2016 11:27 for example ebay.com, every item is on the same layout vishugosain @vishugosain Nov 06 2016 11:27 @heroiczero can you please look at my code and tell me where i am wrong ? heroiczero @heroiczero Nov 06 2016 11:28 @vishugosain sure vishugosain @vishugosain Nov 06 2016 11:28 @heroiczero // Setup var collection = { "2548": { "album": "Slippery When Wet", "artist": "Bon Jovi", "tracks": [ "Let It Rock", "You Give Love a Bad Name" ] }, "2468": { "album": "1999", "artist": "Prince", "tracks": [ "1999", "Little Red Corvette" ] }, "1245": { "artist": "Robert Palmer", "tracks": [ ] }, "5439": { "album": "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if(!collection.id.hasOwnProperty("prop")) { if(prop==="tracks"){collection.id.prop=[];} else collection.id.prop=""; } if(prop==="tracks"){ collection.id.prop.push(value); } else if(prop==="artist"||prop==="album") { collection.id.prop=value; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); Oniichan @ProjectOU Nov 06 2016 11:33 What is wrong with here? function sendlike(){ var text =$( ".likeajax" ).length;
var text2 = "";
var i;
for (i = 0; i < text; i++) {

var newItems = [document.getElementById('box-'+i)];
for (var c = newItems.length; c--;) for (var j = newItems[c].length; j--;)
$(newItems[i][j]).click(function() { alert(this.id); var other_data =$('.likeajax')[i];
console.log(i);
var fd = new FormData(other_data);
$.ajax({ url: 'includes/like.php', data: fd, contentType: false, processData: false, type: 'POST', success: function(data){ console.log(data); } }); }); } } heroiczero @heroiczero Nov 06 2016 11:34 @vishugosain if(!collection.id.hasOwnProperty("prop")) { when is this closed and collection.id.prop=""; are u creating an empty string for other properties? if it does not have the prop? @vishugosain instead of empty string it is asking you to delete the prop when the prop hasOwnProperty is false wolfsbane01 @wolfsbane01 Nov 06 2016 11:40 can someone please help me with the Record Collection challenge heroiczero @heroiczero Nov 06 2016 11:40 @vishugosain if value is empty not the hasOwnProperty @wolfsbane01 what do u need? vishugosain @vishugosain Nov 06 2016 11:42 @heroiczero i am adding an empty string if the prop doesnt exist. Johnny @JohnnyBizzel Nov 06 2016 11:42 @wolfsbane01 Sure, have you got some Wolfsbane in your collection? :) I'll have money to burn someday!! Joseph @revisualize Nov 06 2016 11:45 @vishugosain Dot Notation is a String Literal. Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. @vishugosain !collection.id.hasOwnProperty("prop") again, another string. heroiczero @heroiczero Nov 06 2016 11:45 @vishugosain yeah it just asks you to delete the property if there is nothing in the value of the string. I do not see that in your code. Joseph @revisualize Nov 06 2016 11:46 @vishugosain else if(prop==="artist"||prop==="album") this isn't the correct condition. Oh that note.. It is 345am. I need to get some :zzz: :v: vishugosain @vishugosain Nov 06 2016 11:49 @heroiczero @revisualize string is confusing Joseph @revisualize Nov 06 2016 11:49 There are code comments. And there is an actual comment below that. vishugosain @vishugosain Nov 06 2016 11:49 and i forget the delete condition Joseph @revisualize Nov 06 2016 11:49 @vishugosain String vs Variable. vishugosain @vishugosain Nov 06 2016 11:49 sorry fr that Joseph @revisualize Nov 06 2016 11:50 Anyhow. I need to get to bed. :v: Ashish verma @ashish1500616 Nov 06 2016 11:50 function confirmEnding(str, target) { // "Never give up and good luck will find you." // -- Falcor var len=target.length; var st=str.substr(-1,len); //var st1=str.substr(-1,4); if(st===target) return true; else return false; } confirmEnding("Bastian", "n"); errors:- confirmEnding("He has to give me a new name", "name") should return true. confirmEnding("Open sesame", "same") should return true. heroiczero @heroiczero Nov 06 2016 11:53 @bitian1506 sorry i think that should work Ashish verma @ashish1500616 Nov 06 2016 11:54 ??srry heroiczero @heroiczero Nov 06 2016 11:54 @bitian1506 for single characters Ashish verma @ashish1500616 Nov 06 2016 11:54 @heroiczero i didnt get your point.@heroiczero heroiczero @heroiczero Nov 06 2016 11:56 @bitian1506 it would not work for long characters like confirmEnding("He has to give me a new name", "name") when the target is longer than 1 Ashish verma @ashish1500616 Nov 06 2016 11:57 then how does it is working in this case;confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") should return false. heroiczero @heroiczero Nov 06 2016 11:58 @bitian1506 a hint is using the .length @bitian1506 specification is not on the end of the string. @bitian1506 so it should return false Ashish verma @ashish1500616 Nov 06 2016 11:59 where am i wrong?? heroiczero @heroiczero Nov 06 2016 12:01 @heroiczero var st=str.substr(-1,len); you are just getting the substr of only one letter and for confirmEnding("Open sesame", "same") you need more than one letter. so i would use string.length to determine the length of a string. @bitian1506 i am new so i do not another way to determine the length of the target? Ashish verma @ashish1500616 Nov 06 2016 12:03 var len=target.length; i have taken the number of letter in the target variable and then extracted the substring upto the number of letters in the target variable from back.,, Boris Yordanov @borisyordanov Nov 06 2016 12:06 does toFixed() return a string or a number? Ivan Georgiev @ivangeorgiew Nov 06 2016 12:06 guyz how do I make this map arr[1] to numbers and not strings:  result = result.map(function(arr){ return [arr[0], arr[1].toFixed(2) ]; }); Ashish verma @ashish1500616 Nov 06 2016 12:07 ny1 please help me out Chuks Opia @9jaswag Nov 06 2016 12:07 @Chan11 I just did and it worked...thanks. Lemme take a closer look at the code heroiczero @heroiczero Nov 06 2016 12:08 @bitian1506 for example you are making it start at var st=str.substr(-1,len); you are making it start at -1 @bitian1506 so for Bastian you are starting at only n for "same" on the end of the str you are only getting the "e". Chuks Opia @9jaswag Nov 06 2016 12:09 @bitian1506 you're to slice the length of the number of chars in the target out of the end of str and then compare them Clayton @waterFlowin Nov 06 2016 12:09 var code = "formatted"; zz mistype Diego Mayer @Chrono79 Nov 06 2016 12:09 @ivangeorgiew if that is for exact change, you don't need it, you only need numbers Clayton @waterFlowin Nov 06 2016 12:10 @ivangeorgiew How did you copy/paste your code to this chat in that format to ask your question? Ivan Georgiev @ivangeorgiew Nov 06 2016 12:11 so you mean we dont need the .00 after the numbers? Diego Mayer @Chrono79 Nov 06 2016 12:11 @waterFlowin ctrl+shift+m, use  like shown there Chuks Opia @9jaswag Nov 06 2016 12:12 hey @Chrono79 how you doing today? Diego Mayer @Chrono79 Nov 06 2016 12:12 @ivangeorgiew 5 === 5.00 @9jaswag fine, and you? Chuks Opia @9jaswag Nov 06 2016 12:17 @Chrono79 I'm doing great Clayton @waterFlowin Nov 06 2016 12:18 Why do I receive "SyntaxError: Unexpected token case" Line 4 function caseInSwitch(val) { var answer = ""; // Only change code below this line case (val === 1); answer += "alpha"; break; case val === 2; answer += "beta"; break; case val === 3; answer += "gamma"; break; case val === 4; answer += "delta"; break; // Only change code above this line return answer; } // Change this value to test caseInSwitch(1); Stephen James @sjames1958gm Nov 06 2016 12:19 @waterFlowin you need a switch statement to use cases Diego Mayer @Chrono79 Nov 06 2016 12:19 @waterFlowin look again how switch is build Stephen James @sjames1958gm Nov 06 2016 12:19 @waterFlowin as in switch (val) { then your cases only need the number Chuks Opia @9jaswag Nov 06 2016 12:20 @waterFlowin switch(val){ case x: do sth; break; } sandlasd @sandlasd Nov 06 2016 12:23 function multiplyAll(arr) { var product = 1; // Only change code below this line for (var i=0; i < arr.length; i++) { for (var j=0; j < arr[i].length; j++){ for (var k=0; k < arr[j].length; k++){ product = arr[i]arr[j]*arr[k]; }}} // Only change code above this line return product; } // Modify values below to test your code multiplyAll([[1,2],[3,4],[5,6,7]]); who can help me? Diego Mayer @Chrono79 Nov 06 2016 12:24 @sandlasd you only need 2 loops, one for the outer array, and one for the subarrays Do ctrl+shift+m to see how to markdown your code properly vishugosain @vishugosain Nov 06 2016 12:26 Can someone help me with profile lookup exercise in javascript Diego Mayer @Chrono79 Nov 06 2016 12:28 @vishugosain have you written something yet? vishugosain @vishugosain Nov 06 2016 12:29 function lookUpProfile(firstName, prop){ // Only change code below this line var found; for(var i=0;i<4;i++) { if(contacts[i].firstName===firstName){ if(contacts[i].hasOwnProperty(prop)){ found = contacts[i][prop]; break; } else{ found = "No such property"; break; } } return "No such contact"; } return found; // Only change code above this line } i have written this it works for the call in the program but do not run for test runs Diego Mayer @Chrono79 Nov 06 2016 12:30 @vishugosain don't hardcode the quantity of contacts Think about when you can say for sure: "No such contact" Clayton @waterFlowin Nov 06 2016 12:30 @sjames1958gm @Chrono79 @9jaswag Thank you, I complete misunderstood how to write a switch statement reading it the first few times. CamperBot @camperbot Nov 06 2016 12:30 waterflowin sends brownie points to @sjames1958gm and @chrono79 and @9jaswag :sparkles: :thumbsup: :sparkles: :cookie: 256 | @9jaswag |http://www.freecodecamp.com/9jaswag :star2: 2436 | @chrono79 |http://www.freecodecamp.com/chrono79 :star2: 4203 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm Stephen James @sjames1958gm Nov 06 2016 12:30 @vishugosain You are returning no such contact if the very first contact doesn't match. Perhaps you could set found to a better initial value? @waterFlowin :+1: Tsulatsi Tamim @tsulatsitamim Nov 06 2016 12:32  function findLongestWord(str) { var arr = str.split(' '); var longestString = 0; for (var i=0; i < arr.length; i++){ if( longestString < arr[i].length) { longestString = arr[i].length; } } return longestString; } findLongestWord("The quick brown fox jumped over the lazy dog"); I'm on 'Find the Longest Word in a String'; my code works, but I'm curious did I use the wrong approach or method? thanks Diego Mayer @Chrono79 Nov 06 2016 12:33 @tsulatsitamim no, that's ok You can use some other methods but so far that's ok. You can refactor later when you learn/understand map, reduce and such Tsulatsi Tamim @tsulatsitamim Nov 06 2016 12:35 @Chrono79 thank you CamperBot @camperbot Nov 06 2016 12:35 tsulatsitamim sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles: :star2: 2437 | @chrono79 |http://www.freecodecamp.com/chrono79 Chuks Opia @9jaswag Nov 06 2016 12:47 I need help with the Falsy Bouncer challenge...how do I filter anything false, null, undefined and the rest anyone?? vishugosain @vishugosain Nov 06 2016 12:51 @sjames1958gm @Chrono79 Thanx done it (y) CamperBot @camperbot Nov 06 2016 12:51 vishugosain sends brownie points to @sjames1958gm and @chrono79 :sparkles: :thumbsup: :sparkles: :star2: 2438 | @chrono79 |http://www.freecodecamp.com/chrono79 :star2: 4204 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm U-ways @U-ways Nov 06 2016 12:52 @9jaswag You can use the ! operator! it evaluates a condition and returns true if it's a truthy argument or false if it's a falsey argument! Example: if (!variable) { // If variable is anything false, null, undefined and the rest it will return TRUE return true; } Chuks Opia @9jaswag Nov 06 2016 12:56 @U-ways I know that but then there are different conditions to be checked false, null, 0, "", undefined, and NaN U-ways @U-ways Nov 06 2016 12:56 @9jaswag These are all falsey arguments :D Chuks Opia @9jaswag Nov 06 2016 12:59 wow.... @U-ways I just returned the value and it worked U-ways @U-ways Nov 06 2016 13:00 @9jaswag glad it worked! Read more about such arguments here: https://www.sitepoint.com/javascript-truthy-falsy/ Goodluck :D whbob @whbob Nov 06 2016 13:01 I need help with FCC "Make Object Properties Private". My setGear method is accessible outside the object, but getGear is not. this.getGear = function (findGear) {  return gear ; Is it because gear is private? Chandrahas P @Chan11 Nov 06 2016 13:04 @Sakitha because value=0, it is not going to run if(value) block Sakitha @Sakitha Nov 06 2016 13:06 @Chan11 thank you CamperBot @camperbot Nov 06 2016 13:06 sakitha sends brownie points to @chan11 :sparkles: :thumbsup: :sparkles: :cookie: 313 | @chan11 |http://www.freecodecamp.com/chan11 Deon588 @Deon588 Nov 06 2016 13:07 Hi all i'm busy with the confirm the ending challenge and getting some strange results... For some reason when I log the variable len which is set to be the negated length of the target always returns as -1.. Any idea what i'm doing wrong? my code: \\ function confirmEnding(str, target) { // "Never give up and good luck will find you." // -- Falcor len = -target.length; console.log("len: " + len); console.log("extract: " + str.substr(str.length, len)); if (str.substr(str.length, len) === target) { return true; } else { return false; } } confirmEnding("He has to give me a new name", "name"); \\ Chandrahas P @Chan11 Nov 06 2016 13:07 @Sakitha :+1: @Deon588 str.substr(len) Deon588 @Deon588 Nov 06 2016 13:09 @Sakitha what is that l in the first for loop? @Chan11 i need to extract either the last character or word from str... Sakitha @Sakitha Nov 06 2016 13:13 @Deon588 there was more than one array indexes....anyway now it works.. @Deon588 thanks for the lookup though CamperBot @camperbot Nov 06 2016 13:15 sakitha sends brownie points to @deon588 :sparkles: :thumbsup: :sparkles: :cookie: 18 | @deon588 |http://www.freecodecamp.com/deon588 Chandrahas P @Chan11 Nov 06 2016 13:17 @Deon588 it doesnt matter,u need to find if target matches end of str Lee Stevens @Zaeroso Nov 06 2016 13:18 I am on 'Escaping Literal Quotes in Strings' and I have the code var myStr = "I am a \"double quoted\"string inside \"double quotes\"."; I'm pretty sure this is correct, it should display I am a "double quoted" string inside "double quotes". Whats wrong with it? Deon588 @Deon588 Nov 06 2016 13:18 @Chan11 yes I know. Any idea what i'm doing wrong? Chandrahas P @Chan11 Nov 06 2016 13:19 @Deon588 nothing wrong,run it again Deon588 @Deon588 Nov 06 2016 13:19 the first -1 arg of str.substr is so that it starts from the end. Ghulam Shabir @ghulamshabir Nov 06 2016 13:20 @Zaeroso quoted\"string give a space after the quote Chandrahas P @Chan11 Nov 06 2016 13:21 @Deon588 yes,it starts from end. any problem now ,did it work Deon588 @Deon588 Nov 06 2016 13:23 @Chan11 what do you mean? Should I change anything? It didn't work before... Lee Stevens @Zaeroso Nov 06 2016 13:23 @ghulamshabir ahh it worked. I didn't realise that I messed up some spaces in the final product Chandrahas P @Chan11 Nov 06 2016 13:23 @Deon588 len = -target.length; if (str.substr(len) === target) { return true; } else { return false; } Ghulam Shabir @ghulamshabir Nov 06 2016 13:24 @Zaeroso :smile: Connor @oldpenny Nov 06 2016 13:26 Profile Lookup function lookUp(firstName, prop){ // Only change code below this line for(i=0;i<contacts.length;i++){ if(contacts[i].hasOwnProperty(firstName)){//查询是否存在first if(contacts[i].firstName==firstName){//如果两个first相等 if(contacts[i].hasOwnProperty(prop)){//查询是否存在prop return contacts[i][prop]; }//查询是否存在prop，执行完毕 else{//如果不存在prop return "No such property"; }//如果不存在prop，执行完毕 }//如果两个first相等，执行完毕 }//查询是否存在first完毕 else{//如果不存在first return "No such contact"; }//如果不存在first } // Only change code above this line } help Ghulam Shabir @ghulamshabir Nov 06 2016 13:29 @oldpenny remove first if Connor @oldpenny Nov 06 2016 13:31 let me try Deon588 @Deon588 Nov 06 2016 13:31 @Chan11 Thanks worked fine:) CamperBot @camperbot Nov 06 2016 13:31 deon588 sends brownie points to @chan11 :sparkles: :thumbsup: :sparkles: :cookie: 314 | @chan11 |http://www.freecodecamp.com/chan11 Ghulam Shabir @ghulamshabir Nov 06 2016 13:34 @oldpenny you need if else structure like this if() { if() { } else {...} } Connor @oldpenny Nov 06 2016 13:35 @ghulamshabir OK,thanks Connor @oldpenny Nov 06 2016 13:43 @ghulamshabir like this ? function lookUp(firstName, prop){ // Only change code below this line for(i=0;i<contacts.length;i++){ if(contacts[i].hasOwnProperty(prop)){ if(contacts[i].firstName==firstName){ return contacts[i][prop]; } else{ return "No such contact"; } } else{ return "No such property"; } } } Ghulam Shabir @ghulamshabir Nov 06 2016 13:44 @oldpenny you should check contacts[i] == fristName first @oldpenny your second return should return No such property @oldpenny and finally No such contact where you should return that ? inside loop ? also you don't need second else lixchen @lixchen Nov 06 2016 13:49 i ye come Ghulam Shabir @ghulamshabir Nov 06 2016 13:49 @oldpenny you are supposed to return No such contact when you have checked all the contacts in the array and no match occurred lixchen @lixchen Nov 06 2016 13:50 i ye don't this answe Connor @oldpenny Nov 06 2016 13:50 However, how to realize the two return?My English is not very good, please forgive me @ghulamshabir Ghulam Shabir @ghulamshabir Nov 06 2016 13:52 @oldpenny I mean your first else from top should return No such property not No such contact, you should return No such contact after the loop @lxccl what help do you need ? copy paste your code here lixchen @lixchen Nov 06 2016 13:53 i MarinaDimitrijevic @MarinaDimitrijevic Nov 06 2016 13:53 FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine lixchen @lixchen Nov 06 2016 13:53 i now don't know how to copy paste code to here please wait wait Ghulam Shabir @ghulamshabir Nov 06 2016 13:54 @MarinaDimitrijevic replace newline with \n backslash with \\ and carriagereturn with \r MarinaDimitrijevic @MarinaDimitrijevic Nov 06 2016 13:54 var myStr="FirstLine\n\SecondLine\ThirdLine\r"; // Change this line it's wrong lixchen @lixchen Nov 06 2016 13:55 @oldpenny 怎么粘贴代码到这里 MarinaDimitrijevic @MarinaDimitrijevic Nov 06 2016 13:56 i need this FirstLine \SecondLine\ ThirdLine Connor @oldpenny Nov 06 2016 13:56 @lxccl + 回车-shift Ghulam Shabir @ghulamshabir Nov 06 2016 13:56 @MarinaDimitrijevic you misplaced \r see the above string you posted first, where you need to put \r, it should be after SecondLine Connor @oldpenny Nov 06 2016 13:57 然后出现上下两行,代码写在中间 MarinaDimitrijevic @MarinaDimitrijevic Nov 06 2016 13:58 Did you meen: var myStr="FirstLine\n\SecondLine\rThirdLine"; lixchen @lixchen Nov 06 2016 13:58 //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 lookUp(firstName, prop){ // Only change code below this line for(i = 0; i < contacts.length; i++) { if(contacts[i].firstName == firstName && prop==contacts[i].keys){ return contacts[i].prop; } else if(contacts[i].firstName != firstName) { return 'No such contact'; } else return 'No such property'; } // Only change code above this line } // Change these values to test your function lookUp("Akira", "likes"); U-ways @U-ways Nov 06 2016 13:59 @oldpenny Connor ma man! women bu membai hanyu! :P drowningpool5 @drowningpool5 Nov 06 2016 14:00 hi guys and gals :D I am wondering if I could get some help with starting - Check for Palindromes:) Ghulam Shabir @ghulamshabir Nov 06 2016 14:00 @MarinaDimitrijevic now you have no backslash before \r, backslash and carriage return should be after SecondLine like this \\\r @MarinaDimitrijevic you should assign this entire string to result not myStr Connor @oldpenny Nov 06 2016 14:02 @U-ways nice pinyin Marcin Kluska @marcinkluska Nov 06 2016 14:02 can someone help me dont work my code 'code'$.getJSON("http://ip-api.com/json", function(ipJson){
var url = "http://api.openweathermap.org/data/2.5/weather?q=" + ipJson.city + "&units=imperial&APPID=090df93fca915b0729df1d32d8d37595";
$("#data").html(url); }); 'code' Connor @oldpenny Nov 06 2016 14:02 @ghulamshabir ，thanks man, i know you mean, let me try again U-ways @U-ways Nov 06 2016 14:03 @oldpenny I got a full documentation explaining profilelookup challenge! Would you like me to send it to you? :D (It's long so you've been warned! :P ) Ghulam Shabir @ghulamshabir Nov 06 2016 14:03 @oldpenny :+1: dengbaoling @dengbaoling Nov 06 2016 14:03 qiuzhu 求助 Marcin Kluska @marcinkluska Nov 06 2016 14:04 MarinaDimitrijevic @MarinaDimitrijevic Nov 06 2016 14:04 tnx :) Ghulam Shabir @ghulamshabir Nov 06 2016 14:04 @marcinkluska you need to call $.getJSON(url, function(data) { console.log(data)
@MarinaDimitrijevic mention @name for thanksgivings
Connor
@oldpenny
Nov 06 2016 14:05
@U-ways ,thats great
U-ways
@U-ways
Nov 06 2016 14:05
@oldpenny All done, I sent it to you :D
Jeevan Deep
@Jeevandeep235
Nov 06 2016 14:05

@oldpenny what is the problem in the code
function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.
for(var i=0; i<arr1.lengtn; i++){
if(arr2.indexOf(arr1[i]) === -1){
newArr.push(arr1[i]);
}
}
for(var j=0; j<arr2.length; j++){
if(arr1.indexOf(arr2[j]) === -1){
newArr.push(arr2[j]);
}
}
return newArr;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);

@oldpenny what is the problem in the code
function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.
for(var i=0; i<arr1.lengtn; i++){
if(arr2.indexOf(arr1[i]) === -1){
newArr.push(arr1[i]);
}
}
for(var j=0; j<arr2.length; j++){
if(arr1.indexOf(arr2[j]) === -1){
newArr.push(arr2[j]);
}
}
return newArr;
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5])
@U-ways what is the problem in the code
function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.
for(var i=0; i<arr1.lengtn; i++){
if(arr2.indexOf(arr1[i]) === -1){
newArr.push(arr1[i]);
}
}
for(var j=0; j<arr2.length; j++){
if(arr1.indexOf(arr2[j]) === -1){
newArr.push(arr2[j]);
}
}
return newArr;
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5])
Marcin Kluska
@marcinkluska
Nov 06 2016 14:06
why dont work \$("#data").html(url); ?
Jeevan Deep
@Jeevandeep235
Nov 06 2016 14:07
@ghulamshabir what is the problem in the code
function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.
for(var i=0; i<arr1.lengtn; i++){
if(arr2.indexOf(arr1[i]) === -1){
newArr.push(arr1[i]);
}
}
for(var j=0; j<arr2.length; j++){
if(arr1.indexOf(arr2[j]) === -1){
newArr.push(arr2[j]);
}
}
return newArr;
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5])
U-ways
@U-ways
Nov 06 2016 14:07
@Jeevandeep235 Hello! Please don't spam! Just post it once, we all can see it anyways C:
Jeevan Deep
@Jeevandeep235
Nov 06 2016 14:07
somebody plz help me
U-ways
@U-ways
Nov 06 2016 14:07
@Jeevandeep235 Alright give me a few minutes
@Jeevandeep235 Can you give me the challenge name please? :D
Connor
@oldpenny
Nov 06 2016 14:08
@Jeevandeep235 cool, i need sometime think about thought in the this code.
Jeff Shapiro
@Jeff-Shapiro
Nov 06 2016 14:08
@Jeevandeep235 try spelling correctly
sandlasd
@sandlasd
Nov 06 2016 14:09
How to send a picture here
U-ways
@U-ways
Nov 06 2016 14:09
@sandlasd Just drag and drop it in the chat box :D
Stephen James
@sjames1958gm
Nov 06 2016 14:10
ctrl-shift-m will give the details for posting formatted code
U-ways
@U-ways
Nov 06 2016 14:10
@sandlasd Click and hold the file to the chat box and it will be sent!
@sjames1958gm Hello Stephen! :D How have you been?
Stephen James
@sjames1958gm
Nov 06 2016 14:11
@U-ways Good, yourself?
U-ways
@U-ways
Nov 06 2016 14:11
@sjames1958gm Am all good! :D
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:11
@Jeevandeep235 typo in length
Jeevan Deep
@Jeevandeep235
Nov 06 2016 14:12
@U-ways Diff Two Array
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:12
@Jeevandeep235 you have misspelled .length in one of loops
Jeevan Deep
@Jeevandeep235
Nov 06 2016 14:13
@Jeff-Shapiro correct spelling only
@ghulamshabir output is comeing correctly
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:14
@Jeevandeep235 :smile:
Anirban Mukherjee
@bwayne2015
Nov 06 2016 14:25
I am getting myVar = myVar should be be changed error
this is my code

var myVar = 87;

// Only change code below this line
var x;

myVar = ++ myVar;

Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:27
@bwayne2015 ++ increments the variable by one in place (mutates it), you don't need to reset it
Saminda
@Saminda1
Nov 06 2016 14:29

any idea what im doing wrong?
function testLogicalAnd(val) {
// Only change code below this line

if (val <= 50 && val >= 25)  {
return "Yes";
}

}

// Only change code above this line
return "No";
}

// Change this value to test
testLogicalAnd(10);

Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:30
@bwayne2015
a = 7;
a++; // now a is 8
Joran de Haan
@LeCoquille
Nov 06 2016 14:30
Hi guys, im doing fibonacci challenge, but my page keeps crashing :
function sumFibs(num) {

var fib = [];
var evenArr = [];

fib[0] = 0;
fib[1] = 1;

for(var i=2; i<=num; i++)
{
fib[i] = fib[i-2] + fib[i-1];
}

for(var o = 0; o<fib.length; o++) {
if(fib[o] % 2 !== 0){
evenArr.push(fib[o]);
}
}

function add(a, b) {
return a + b;
}

var numberFinal = evenArr.reduce(add);
return numberFinal;

}

sumFibs(25);
Anyone know what could cause this?
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:31
@Saminda1 you have one extry }, which puts return "No" outside of function
Joran de Haan
@LeCoquille
Nov 06 2016 14:31
Also, I can't load freecodecamp in chrome aymore, it's stuck from the moment it's loaded
Saminda
@Saminda1
Nov 06 2016 14:32
oops didnt see that
thanks @ghulamshabir
CamperBot
@camperbot
Nov 06 2016 14:32
saminda1 sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:cookie: 864 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:34
@LeCoquille append autorun=disabled to url of fcc
sandlasd
@sandlasd
Nov 06 2016 14:36

Modify the function checkObj check the myObj checkProp property, if the property exists, return the property values, if not, return "Not Found. // Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here
if(myObj.hasOwnProperty.checkProp){

return myObj.checkProp;
}else{
}
}
// Test your code by modifying these values

what is wrong with me?
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:38
@sandlasd .hasOwnProperty is function give it parens and put in them checkProp and also you can not use dot notation for variables to access property from an object
Michel4ngelo
@Michel4ngelo
Nov 06 2016 14:38
Cage Echarte
@CageEcharte
Nov 06 2016 14:40
I need help with Make instances of Objects with a Constructor Function
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:40
@Michel4ngelo You mean this challenge ?
FirstLine
\SecondLine\
ThirdLine
Michel4ngelo
@Michel4ngelo
Nov 06 2016 14:40
yep
essentially I don't understand what I'm supposed to do @ghulamshabir
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:43

@Michel4ngelo

FirstLinenewlinebacklashSecondLinebackslashcarriagereturnThirdlLine

you need to replace newline with \n backlash with\and carriagereturn with\r, and assign the string toresult

@CageEcharte post your code
Cage Echarte
@CageEcharte
Nov 06 2016 14:44

var myCar = new Car();

Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:44
@sandlasd did it work ?
Wasiu Idowu
@Hoxtygen
Nov 06 2016 14:44
@dhcodes you here?
Kodemar Gaurav Thantry
@gauravthantry
Nov 06 2016 14:45

@gauravthantry
function confirmEnding(str, target) {
var arr=[];
var arr1=[];
var m=0;
if(target.length===1){
arr = str.split("");
if(arr[arr.length-1]===target)
return true;
else if(arr[arr.length-1]!==target)
return false;
}
else if(target.length>1){
arr = str.split(" ");

if(arr[arr.length-1]===target)
return true;
else if(arr[arr.length-1]!==target)
return false;
}

var string=arr[arr.length-1];
for(i=0;i<string.length;i++){
if(string.substr(i,string.length-1)===target)
return true;
m = 1;}
if(m===0)
return false;

}

confirmEnding("Bastian", "n");

can anyone help me out here? most of the code is correct, I'm only not able to check if the substring of the last string of the array matches with the compared string.
confirmEnding("Open sesame", "same")
for this case
the above condition should also return true

Wasiu Idowu
@Hoxtygen
Nov 06 2016 14:45
@dhcodes the node js finally worked yesterday, was initially doing it all wrong
sandlasd
@sandlasd
Nov 06 2016 14:46
I see, but there's a little bit of a problem.@ghulamshabir
RayVoldemort
@RayVoldemort
Nov 06 2016 14:46
I do not know how to do this
Wasiu Idowu
@Hoxtygen
Nov 06 2016 14:46
@dhcodes thanks for the link you provided
CamperBot
@camperbot
Nov 06 2016 14:46
hoxtygen sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1560 | @dhcodes |http://www.freecodecamp.com/dhcodes
Md. Sany Ahmed
@sany2k8
Nov 06 2016 14:46
hey , what is the issue on this piece of code
Md. Sany Ahmed
@sany2k8
Nov 06 2016 14:46

// Setup
var a;
var b = 7;

// Only change code below this line
a = 7;
b = a;

Do not change code above the line
a should have a value of 7
b should have a value of 7
a should be assigned to b with =
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:47
@sany2k8 your code looks good, what error ?
Cage Echarte
@CageEcharte
Nov 06 2016 14:47

@ghulamshabir var myCar = new Car();

Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:48
@CageEcharte challenge name ?
izakibikas
@izakibikas
Nov 06 2016 14:48
@RayVoldemort
 if (2 <= card && card <= 6) {
count++;
} else if (7 <= card && card <= 9) {
// do nothing
} else {
count--;
}

if (count > 0) {
return count + " Bet";
} else {
return count + " Hold";
}
CamperBot
@camperbot
Nov 06 2016 14:48
:bulb: to format code use backticks!  more info
Md. Sany Ahmed
@sany2k8
Nov 06 2016 14:48
I know its ok , but not able to move to another problem
sandlasd
@sandlasd
Nov 06 2016 14:48

// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here
if(myObj.hasOwnProperty){

return myObj[checkProp];
}else{
}
}

      Why I can't get the output  "Not Found"              
Cage Echarte
@CageEcharte
Nov 06 2016 14:48
@ghulamshabirMake Instances of Objects with a Constructor Function
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:49
@sandlasd .hasOwnProperty(checkProp)
izakibikas
@izakibikas
Nov 06 2016 14:49
@sandlasd wrong brackets
sandlasd
@sandlasd
Nov 06 2016 14:50
Yes, I see. It's too careless，Thank you very much
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:50
@sany2k8 refresh your browser
RayVoldemort
@RayVoldemort
Nov 06 2016 14:50
@izakibikas ok I will try it
Md. Sany Ahmed
@sany2k8
Nov 06 2016 14:50
@ghulamshabir got it , may be I have changed the initial code :(
Ghulam Shabir
@ghulamshabir
Nov 06 2016 14:50
@sandlasd mention @name for thanksgivings
Md. Sany Ahmed
@sany2k8
Nov 06 2016 14:50
@ghulamshabir its working now...:)
Kodemar Gaurav Thantry
@gauravthantry
Nov 06 2016 14:50

@gauravthantry
function confirmEnding(str, target) {
var arr=[];
var arr1=[];
var m=0;
if(target.length===1){
arr = str.split("");
if(arr[arr.length-1]===target)
return true;
else if(arr[arr.length-1]!==target)
return false;
}
else if(target.length>1){
arr = str.split(" ");

if(arr[arr.length-1]===target)
return true;
else if(arr[arr.length-1]!==target)
return false;
}

var string=arr[arr.length-1];
for(i=0;i<string.length;i++){
if(string.substr(i,string.length-1)===target)
return true;
m = 1;}
if(m===0)
return false;

}

confirmEnding("Bastian", "n");

can anyone help me out here? most of the code is correct, I'm only not able to check if the substring of the last string of the array matches with the compared string.
confirmEnding("Open sesame", "same")
for this case
the above condition should also return true