These are chat archives for FreeCodeCamp/HelpJavaScript

7th
May 2017
HeebieGeeBee
@HeebieGeeBee
May 07 2017 00:00
havent tried though
Kaeleigh
@Kaeleigh
May 07 2017 00:00
So I know I must use the array .push and .shift however, I'm unsure where to place the code. This is what I have so far:
function nextInLine(arr, item) {
  // Your code here
  arr.push([6]); 
  // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];
 testArr = nextInLine.shift();
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Vamp
@the-vampiire
May 07 2017 00:00
@vk2mars sorry I didn’t see you passing initial value of 0 lol. im like ya you can’t add an array to an integer...
canoid
@canoid
May 07 2017 00:00
the issue is that I don't know were the code goes , I don't think it goes in the result variable
Keon Samuel
@keonsam
May 07 2017 00:01
post code
Vamp
@the-vampiire
May 07 2017 00:01
@vk2mars you can try what @HeebieGeeBee said or using Number(available.toFixed(2));
Joseph
@revisualize
May 07 2017 00:01
@Kaeleigh Do you know what parameters are?
Kaeleigh
@Kaeleigh
May 07 2017 00:01
I believe the parameters are arr & item
Joseph
@revisualize
May 07 2017 00:02
@Kaeleigh Correct.
@Kaeleigh What does arr represent?
@Kaeleigh What does item represent?
Keon Samuel
@keonsam
May 07 2017 00:02
array
Vamp
@the-vampiire
May 07 2017 00:02
@vk2mars
cid = [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]

var available = cid.reduce(
    function(a,v){

        console.log('a: ', a);
        console.log('v[1]: ', v[1]);
        return a + v[1];
    }, 0);

console.log(Number(available.toFixed(2))); // 335.41
canoid
@canoid
May 07 2017 00:02
@sjames1958gm thanks it works! ( but still don't know how lol)
Vamp
@the-vampiire
May 07 2017 00:03
you have to pass it through the Number function because toFixed will truncate the decimals but returns a string
Stephen James
@sjames1958gm
May 07 2017 00:03
@canoid It checks that there are spaces on either side of the words passed in.
Kaeleigh
@Kaeleigh
May 07 2017 00:03
@revisualize arr represents array and I'm not sure what item represents
Joseph
@revisualize
May 07 2017 00:04
@Kaeleigh It tells you in the instructions.
Aizaz Shahid
@aizazshahid
May 07 2017 00:04
@the-vampiire don't know you will happy or not :) but i made your idea.

for(var i= 0; i< 5; i++) {
    eval('var abc' + i + ' = i;');
}

console.log(abc1);
kerafyrm02
@kerafyrm02
May 07 2017 00:04
Any suggestions to making this faster?
function updateRecords(id, prop, value) {

  var file = collection[id];

  switch(true) {

    case file.hasOwnProperty(prop) && value === '':
      delete file[prop];
      break;

    case file.hasOwnProperty(prop) === false && prop === 'tracks':
      file[prop] = [];
      file[prop].push(value); 
      break;

    case file.hasOwnProperty(prop) === false && prop === 'artist':
      file[prop] = value;
      break;

    default:
      file[prop].push(value);

  }

  return collection;
}
Kaeleigh
@Kaeleigh
May 07 2017 00:04
@revisualize item represents number
Aizaz Shahid
@aizazshahid
May 07 2017 00:04
now i deserve a brownie hahahahah
just joking!
Joseph
@revisualize
May 07 2017 00:04
@Kaeleigh Great.
Dovydas Stirpeika
@Giveback007
May 07 2017 00:05
what is .slice.call
Joseph
@revisualize
May 07 2017 00:05
@Kaeleigh What should you be adding the end of the array?
Aizaz Shahid
@aizazshahid
May 07 2017 00:05
@Masd925 @the-vampiire :point_up: May 7, 2017 5:04 AM
Vamp
@the-vampiire
May 07 2017 00:05
@forwebtech hah ya that worked. good job dude
Aizaz Shahid
@aizazshahid
May 07 2017 00:05
@the-vampiire but you raised that question :)
Vamp
@the-vampiire
May 07 2017 00:05
never heard of eval before
so that “evaluates” a string?
Christian
@Neralizer
May 07 2017 00:05
@sjames1958gm I seem to remember you being a Chelsea fan!
Kaeleigh
@Kaeleigh
May 07 2017 00:06
@revisualize a number?
Aizaz Shahid
@aizazshahid
May 07 2017 00:06
@the-vampiire mdn.io/eval
Stephen James
@sjames1958gm
May 07 2017 00:06
@Neralizer yes!
Vamp
@the-vampiire
May 07 2017 00:06
@forwebtech duuuude
Mohamed Derhalli
@derhallim
May 07 2017 00:06
@sjames1958gm :v:
@forwebtech :v:
Christian
@Neralizer
May 07 2017 00:06
@sjames1958gm if you can help me figure out arr.reduce, I'll call Arsene to sell you Alexis
Vamp
@the-vampiire
May 07 2017 00:06
@forwebtech this opens up so many possibilities for automation holy shit
Stephen James
@sjames1958gm
May 07 2017 00:06
@derhallim :wave:
Vamp
@the-vampiire
May 07 2017 00:06
@forwebtech thanks. and remind me every day this week to thank you again
CamperBot
@camperbot
May 07 2017 00:06
the-vampiire sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 434 | @forwebtech |http://www.freecodecamp.com/forwebtech
Joseph
@revisualize
May 07 2017 00:06
@Kaeleigh Not just a number but the parameter that represents a number.
HeebieGeeBee
@HeebieGeeBee
May 07 2017 00:06
@derhallim :wave:
kerafyrm02
@kerafyrm02
May 07 2017 00:06
Anyone have something more efficient?
function updateRecords(id, prop, value) {

  var file = collection[id];

  switch(true) {

    case file.hasOwnProperty(prop) && value === '':
      delete file[prop];
      break;

    case file.hasOwnProperty(prop) === false && prop === 'tracks':
      file[prop] = [];
      file[prop].push(value); 
      break;

    case file.hasOwnProperty(prop) === false && prop === 'artist':
      file[prop] = value;
      break;

    default:
      file[prop].push(value);

  }

  return collection;
}
Dovydas Stirpeika
@Giveback007
May 07 2017 00:07

what are things I need to understand before I can solve
https://www.freecodecamp.com/challenges/arguments-optional

I feel like I'm in over my head on this one

Mohamed Derhalli
@derhallim
May 07 2017 00:07
@HeebieGeeBee hey man wassup
Vamp
@the-vampiire
May 07 2017 00:07
@forwebtech you can write code that wil….write code...
HeebieGeeBee
@HeebieGeeBee
May 07 2017 00:07
@derhallim not a lot, hows you?
Aizaz Shahid
@aizazshahid
May 07 2017 00:07
@the-vampiire but remember eval is very dangerous one, in that guide the there is a heading: Don't use eval needlessly!
Mohamed Derhalli
@derhallim
May 07 2017 00:07
@Neralizer Arsene Wenger didn't buy Suarez for an extra $100? :joy:
Aizaz Shahid
@aizazshahid
May 07 2017 00:07
read the para below their !
Mohamed Derhalli
@derhallim
May 07 2017 00:07
@HeebieGeeBee gd gd
@HeebieGeeBee been a while
Christian
@Neralizer
May 07 2017 00:07
hahahahahaha
Nicolas Ramirez
@kamatheuska
May 07 2017 00:08
Any idea what I am doing wrong here?
function palindrome(str) {
  // Good luck!

  var nonAlpha = /\W+|[\u0020-\u002F]+|[\u005B-\u0060]+/g; 
  var strTest = str.replace(nonAlpha,"");
  var strFinal = strTest.toLowerCase();

  if (strTest == strTest.split("").reverse().join("")) {
    return true;
  }
  return false;
}
palindrome("0_0 (: /-\ :) 0-0");
Joseph
@revisualize
May 07 2017 00:08
@kerafyrm02
function updateRecords(id, prop, value) {
  if (value !== "" && prop !== "tracks") {
    collection[id][prop] = value;
  }
  if (prop === "tracks" && value !== "") {
    if (!collection[id].hasOwnProperty(prop)) {
      collection[id][prop] = [];
    }
    collection[id][prop].push(value);
  }
  if (value === "") {
    delete collection[id][prop];
  }

  return collection;
}
Aizaz Shahid
@aizazshahid
May 07 2017 00:08
@the-vampiire :+1: you made our day :fire:
@the-vampiire thanks !
CamperBot
@camperbot
May 07 2017 00:08
forwebtech sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 358 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Kaeleigh
@Kaeleigh
May 07 2017 00:08
@revisualize so: item.push();
Christian
@Neralizer
May 07 2017 00:08
@derhallim if only we had Suarez, and Wenger wasn't so ridiculous with his lowballing
Joseph
@revisualize
May 07 2017 00:08
@Kaeleigh What is the value of item?
Christian
@Neralizer
May 07 2017 00:08
okay, here's where I'm at
kerafyrm02
@kerafyrm02
May 07 2017 00:08
Case statements are faster than if statements Joesph..
Christian
@Neralizer
May 07 2017 00:08
function sumAll(arr) {
  var max = Math.max(...arr);
  var min = Math.min(...arr);

  return max + min;
}

sumAll([1, 4]);
Mohamed Derhalli
@derhallim
May 07 2017 00:08
@Neralizer Arsene Wenger had the chance to get PK, Messi and Fabregas in 2003, but he said nah I will take only one :joy:
Joseph
@revisualize
May 07 2017 00:08
@kerafyrm02 Okay.
Mohamed Derhalli
@derhallim
May 07 2017 00:08
and he took Fabregas
HeebieGeeBee
@HeebieGeeBee
May 07 2017 00:08
@derhallim arson wengar hasnt kept his job for nearly 20 years dispite having won nothing for feckin ages, cus of his liberal attitude to signing fees
Vamp
@the-vampiire
May 07 2017 00:09
Screen Shot 2017-05-06 at 8.08.50 PM.png
Stephen James
@sjames1958gm
May 07 2017 00:09
@Neralizer lol.
function reduce(array, fn, init) { 
   var acc = init;
   var i = 0;
   if (!acc) array[i++];
   for (; i < array.length; i++) {
      acc = fn(acc, array[i]);
   }       

  return acc;
}
Mohamed Derhalli
@derhallim
May 07 2017 00:09
he had the chance to get Messi in 2003 man ... he could buy Messi and PK in 2003 along with Fabregas
Vamp
@the-vampiire
May 07 2017 00:09
gives me the gift of creation. warns me to be careful and that there are better options…doesnt link or describe any of these options -_-
Mohamed Derhalli
@derhallim
May 07 2017 00:09
but he doesn't like to spend $$$
Christian
@Neralizer
May 07 2017 00:09
look, I'm all for Arsene having a good business plan, but it's clear we are terrible this year. now @sjames1958gm , what does all of this mean
because I'm trying to understand it from the MDN
Joseph
@revisualize
May 07 2017 00:10
@Kaeleigh Look, item is a number. You can't use an Array method on a number.
Mohamed Derhalli
@derhallim
May 07 2017 00:10
@Neralizer he doesn't have a business plan, he's a flop
Nicolas Ramirez
@kamatheuska
May 07 2017 00:10
Any idea what I am doing wrong here?
function palindrome(str) {
  // Good luck!

  var nonAlpha = /\W+|[\u0020-\u002F]+|[\u005B-\u0060]+/g; 
  var strTest = str.replace(nonAlpha,"");
  var strFinal = strTest.toLowerCase();

  if (strTest == strTest.split("").reverse().join("")) {
    return true;
  }
  return false;
}
palindrome("0_0 (: /-\ :) 0-0");
well i don't read the warning just seen the heading :)
Vamp
@the-vampiire
May 07 2017 00:10
@forwebtech I did
Stephen James
@sjames1958gm
May 07 2017 00:11
@Neralizer So this is what reduce is doing. It s calling the function provided on each value in the function.
The return value from the previous call becomes the first parameter for the next call
It is sometimes called accumulator because it accumulates all the results.
Vamp
@the-vampiire
May 07 2017 00:11
im saying it says not to use eval “needlessly” says there are better options then doesnt link or describe any of these better options
Christian
@Neralizer
May 07 2017 00:11
so arr.reduce is its own function? @sjames1958gm
Stephen James
@sjames1958gm
May 07 2017 00:11
@kamatheuska Is that Regex removeing _
@Neralizer Yes.
Kaeleigh
@Kaeleigh
May 07 2017 00:11
@revisualize Ok so how do you add a number if you can't use an array method
Vamp
@the-vampiire
May 07 2017 00:12
@kerafyrm02 idk how to test for efficiency but im going to assume yours is more efficient lol. here’s mine
// Only change code below this line
function updateRecords(id, prop, value) {

    var target = collection[id];

// if any prop value is empty delete that property

    if(value === "") {
        delete target[prop];
        return collection;
    }

// if prop doesn't equal tracks and value isn't empty

    if(prop !== 'tracks' && value !== ''){
        target[prop] = value;
        return collection;
    }

// if prop is tracks

    if(prop === 'tracks'){

    // no current tracks property
        if(!target.hasOwnProperty(prop)){
            target[prop]= [value];
            return collection;
        }

    // tracks property array is not empty
        if(value !== '') {
            console.log(target[prop]);
            target[prop].push(value);
            return collection;
        }

    }

}
Stephen James
@sjames1958gm
May 07 2017 00:12
@Neralizer I wrote it here where the array is passed in but for arr.reduce the array is from the call
Joseph
@revisualize
May 07 2017 00:12
@Kaeleigh You can use an array method on an array.
Vamp
@the-vampiire
May 07 2017 00:12
@Neralizer it’s an array method
Stephen James
@sjames1958gm
May 07 2017 00:12
@the-vampiire If you return when value === "" you never have to test value again.
Aizaz Shahid
@aizazshahid
May 07 2017 00:12
@the-vampiire you are right !
Joseph
@revisualize
May 07 2017 00:13
@Kaeleigh arr is an array.
Nicolas Ramirez
@kamatheuska
May 07 2017 00:13
@sjames1958gm thanks! I already solved it
CamperBot
@camperbot
May 07 2017 00:13
kamatheuska sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7167 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
May 07 2017 00:13
@kamatheuska :+1: :checkered_flag:
Mohamed Derhalli
@derhallim
May 07 2017 00:13
@kamatheuska nice piano
Vamp
@the-vampiire
May 07 2017 00:13
@sjames1958gm sorry I don’t follow. would you mind imposing your suggestion onto my code so I can see it?
Mohamed Derhalli
@derhallim
May 07 2017 00:13
@kamatheuska does it write code?
kerafyrm02
@kerafyrm02
May 07 2017 00:14
Vampire., there's an alternative to eval()
Mohamed Derhalli
@derhallim
May 07 2017 00:14
is it eval or evil?
kerafyrm02
@kerafyrm02
May 07 2017 00:14
But eval() is best if you know the data is from trusted source.
Nicolas Ramirez
@kamatheuska
May 07 2017 00:14
Some day, some day @derhallim...but no, thats an acoustic one
Mohamed Derhalli
@derhallim
May 07 2017 00:14
oh
Stephen James
@sjames1958gm
May 07 2017 00:14
@the-vampiire so your first if is testing if value === "" if so it returns.
Then you know that for the rest of the code value has !== "" so you don't have to check that again.
Vamp
@the-vampiire
May 07 2017 00:14
@kerafyrm02 what’s the alternative? my mind is fucking blown right now. you can use that to make your code write code..
kerafyrm02
@kerafyrm02
May 07 2017 00:15
Look up Function-constructor:
Kaeleigh
@Kaeleigh
May 07 2017 00:15
@revisualize Ok so I see arr.shift(); returns 2
Joseph
@revisualize
May 07 2017 00:15
@Kaeleigh Okay. That of course depends on what the arguments passed to the function are.
Vamp
@the-vampiire
May 07 2017 00:16
@sjames1958gm
// Only change code below this line
function updateRecords(id, prop, value) {

    var target = collection[id];

// if any prop value is empty delete that property

    if(value === "") {
        delete target[prop];
        return collection;
    }

// if prop doesn't equal tracks and value isn't empty

    if(prop !== 'tracks'){
        target[prop] = value;
        return collection;
    }

// if prop is tracks

    if(prop === 'tracks'){

    // no current tracks property
        if(!target.hasOwnProperty(prop)){
            target[prop]= [value];
            return collection;
        }

    // tracks property array is not empty

            console.log(target[prop]);
            target[prop].push(value);
            return collection;


    }

}
like this?
damn
@sjames1958gm cleaner than a fresh shave
kerafyrm02
@kerafyrm02
May 07 2017 00:16
i prefer case statements. They're faster.
Stephen James
@sjames1958gm
May 07 2017 00:16
@the-vampiire Right and the same can be done for after you check prop !== tracks and return
you don't need to check prop === "tracks"
kerafyrm02
@kerafyrm02
May 07 2017 00:17
You do actually.
Vamp
@the-vampiire
May 07 2017 00:17
you do
kerafyrm02
@kerafyrm02
May 07 2017 00:17
tracks you add to array.
Vamp
@the-vampiire
May 07 2017 00:17
what if they pass something other than tracks
kerafyrm02
@kerafyrm02
May 07 2017 00:17
artists you add string
Stephen James
@sjames1958gm
May 07 2017 00:17
@the-vampiire You have already returned
    if(prop !== 'tracks'){
        target[prop] = value;
        return collection;
    }
Vamp
@the-vampiire
May 07 2017 00:18
hm I see
technically I could remove all the return collections and just have one at the end then
Stephen James
@sjames1958gm
May 07 2017 00:18
@the-vampiire Then you would have to use else if and else
Vamp
@the-vampiire
May 07 2017 00:18
@kerafyrm02 what are the alternatives to eval!
@sjames1958gm oh like you did okay
kerafyrm02
@kerafyrm02
May 07 2017 00:18
function evil(fn) {
  return new Function('return ' + fn)();
}

console.log( evil('12/5*9+9.4*2') ); // => 40.4  (( From Stackoverflow)
Vamp
@the-vampiire
May 07 2017 00:19
is that a joke
lol
kerafyrm02
@kerafyrm02
May 07 2017 00:19
Nope.
Vamp
@the-vampiire
May 07 2017 00:19
evil is the alternative to eval?
kerafyrm02
@kerafyrm02
May 07 2017 00:19
Shrug- lol.
Vamp
@the-vampiire
May 07 2017 00:20
you making fun of my pronunciation?!
im gonna send an evil function your way brah
no but seriously I dont see how that is safer. can you explain or share the SO link if they explain it?
couldnt they still pass anything into evil?
Vamp
@the-vampiire
May 07 2017 00:22
Screen Shot 2017-05-06 at 8.22.02 PM.png
so it is just as dangerous..
kerafyrm02
@kerafyrm02
May 07 2017 00:22
Shrug-- it's an alternative.
Vamp
@the-vampiire
May 07 2017 00:22
im asking for the alternatives MDN claims are avaiable but doesnt discuss. from the MDN eval page:
Screen Shot 2017-05-06 at 8.08.50 PM.png
aye I guess I should have qualified it: a safer alternative to eval
kerafyrm02
@kerafyrm02
May 07 2017 00:23
I doubt there could be otherwise eval would be obsolete.
Aizaz Shahid
@aizazshahid
May 07 2017 00:23
@the-vampiire i made it a dangerous example !
function evil(fn) {
  return new Function('return ' + fn)();
}

console.log( evil('document.write("look at this what am doing with your code");') );
@the-vampiire just run it locally in your html file.
now we can realized how much it can make our code vulnerable !
:D hahaha
i think it's not a good idea to use it!
i think any thing which accepting data from client side is dangerous, doesn't matter it's .eval() or other things !
TayCodes
@TayCodes
May 07 2017 00:28

Hi everyone. Could anypne tell me why my splice method is deleting my todoslist items backwards please? function dele (position, amount) {
var amount = 1;
var position = ((parseInt(prompt("What is the number of the item you want to delete?")))+1);

todo.splice(position, amount);

}

Joseph
@revisualize
May 07 2017 00:29

Suggested changes to this text:

Stand In Line is a CheckPoint where you're supposed to:
Write a function nextInLine which has two parameters
an array (arr) and a number (item).
That part has been done for you here:

function nextInLine(arr, item) { }

With that function declaration you have a function name of nextInLine. You have two parameters arr which represents an array passed into the function and item that represents a number passed to the function.
A few example function calls:
nextInLine([4,3,2] , 1) the values passed to arr is [4,3,2] and the value passed to item is 1
nextInLine([2,4,6,8] , 10) ... arr is [2,4,6,8] & item is 10
nextInLine([2,3,5,7,11] , 13) ... arr is [2,3,5,7,11] &itemis13(first 5 and 6th prime numbers)nextInLine([] , 0)...arris[]&itemis0`

Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).

Again the two parameters for the nextInLine function are arr & item.

Per the instructions: 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.

You need to add the number (item) to the end of an array (arr).
You also need to remove the first element from an array (arr).

Then you need to have your function return the removed element from the array arr.

kerafyrm02
@kerafyrm02
May 07 2017 00:31
function updateRecords(id, prop, value) {

  var file = collection[id];

  switch(true) {

    case file.hasOwnProperty(prop) && value === '':
      delete file[prop];
      break;

    case file.hasOwnProperty(prop) === false && prop === 'tracks':
      file[prop] = [];
      file[prop].push(value); 
      break;

    case file.hasOwnProperty(prop) === false && prop === 'artist':
      file[prop] = value;
      break;

    default:
      file[prop].push(value);

  }

  return collection;
}
So anything faster?
charlotteengland
@charlotteengland
May 07 2017 00:31

Hello everyone,
could you help me solve a seemingly simple task...
to manipulate arrays with unshift.
What am I doing incorrectly here:

var ourArray = ["Stimpson", "J", "cat"];
ourArray.shift(); // ourArray now equals ["J", "cat"]
ourArray.unshift("Happy");
// ourArray now equals ["Happy", "J", "cat"]

// Setup
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();

// Only change code below this line.
myArray.unshift("Paul", 35);

*^^ sorry forgot to add, this is the challenge:
Add ["Paul",35] to the beginning of the myArray variable using unshift().
Aizaz Shahid
@aizazshahid
May 07 2017 00:32
@charlotteengland use brackets in your parameter
["Paul", 35] because it needs a array having 2 values !
Vamp
@the-vampiire
May 07 2017 00:33
So under what scenario would eval be dangerous?
kerafyrm02
@kerafyrm02
May 07 2017 00:34
Where a user could input the values.
hekri-d
@hekri-d
May 07 2017 00:34
@charlotteengland format the code please (put it inside ```
charlotteengland
@charlotteengland
May 07 2017 00:34
Hi @forwebtech, wow I had not idea what I was doing wrong.
Many thanks!
CamperBot
@camperbot
May 07 2017 00:34
charlotteengland sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 435 | @forwebtech |http://www.freecodecamp.com/forwebtech
Vamp
@the-vampiire
May 07 2017 00:34
But you could filter the inputs for dangerous cases couldn't you?
Aizaz Shahid
@aizazshahid
May 07 2017 00:34
@the-vampiire indeed, as we do in forms, i think !
@the-vampiire did you know what's that XSS ??
kerafyrm02
@kerafyrm02
May 07 2017 00:35
yes., but think of it like this.. why aim a loaded gun at your head?
Lots of potential exploits with eval.
XSS is just 1 of many.
Aizaz Shahid
@aizazshahid
May 07 2017 00:36
@the-vampiire that's called cross site scripting, you can search it for further details.
that's the big issue, when we are dealing with data, made by users !
hekri-d
@hekri-d
May 07 2017 00:36
@kerafyrm02 aiming a loaded gun at ones head might be desired behaviour sometimes. :grin:
kerafyrm02
@kerafyrm02
May 07 2017 00:37
XSS you can steal cookies and sign in as the person... or use their tokens to sign into accounts
Aizaz Shahid
@aizazshahid
May 07 2017 00:37
@kerafyrm02 :D cookies who used that technique to store login passwords :D
kerafyrm02
@kerafyrm02
May 07 2017 00:38
You all know how to read stored passwords in a browser right?
ie... Fields with ************************
Aizaz Shahid
@aizazshahid
May 07 2017 00:38
how ??
kerafyrm02
@kerafyrm02
May 07 2017 00:38
Super easy..
open console log
change type="passwords" to type="text"
Shows password in plain text
Aizaz Shahid
@aizazshahid
May 07 2017 00:39
are you trying me to laugh ?
kerafyrm02
@kerafyrm02
May 07 2017 00:39
Im serious. Try it.
Aizaz Shahid
@aizazshahid
May 07 2017 00:39
but that only i can do on my machine !
i already know my passwords :stuck_out_tongue:
kerafyrm02
@kerafyrm02
May 07 2017 00:40
Of course. In case you forget.
I don't share illegal stuff :P
Aizaz Shahid
@aizazshahid
May 07 2017 00:40
but that can't be illegal unless we used as illegal !
you can share with me privately :)
kerafyrm02
@kerafyrm02
May 07 2017 00:40
I bet..
Aizaz Shahid
@aizazshahid
May 07 2017 00:40
i will be glad of you :fire:
kerafyrm02
@kerafyrm02
May 07 2017 00:41
Are you familiar with MITM?
Aizaz Shahid
@aizazshahid
May 07 2017 00:41
no.
kerafyrm02
@kerafyrm02
May 07 2017 00:42
Basically., any wifi which is free is to connect to or any wifi you connect to which other users are too,. are vunerable to showing all their passwords.
ie. Starbucks users.
Aizaz Shahid
@aizazshahid
May 07 2017 00:42
seems we should to talk privately :D
kerafyrm02
@kerafyrm02
May 07 2017 00:42
MITM, NMAP, WIRESHARK.
ETTERCAP
All you need.
Well the last three specifically.
The term MITM is what you're actually doing.
Anyhow back to JS.. lol.
Aizaz Shahid
@aizazshahid
May 07 2017 00:44
hahaha yes !
we are going somewhere in reality :D
kerafyrm02
@kerafyrm02
May 07 2017 00:44
download Kali Linux
Aizaz Shahid
@aizazshahid
May 07 2017 00:45
why it should not named as black linux
kerafyrm02
@kerafyrm02
May 07 2017 00:45
And dual boot your OS
Aizaz Shahid
@aizazshahid
May 07 2017 00:45
Kali is urdu word !
kerafyrm02
@kerafyrm02
May 07 2017 00:45
I use linux on my other laptop... this is my apple one
Aizaz Shahid
@aizazshahid
May 07 2017 00:45
i think someone Asian made it
kerafyrm02
@kerafyrm02
May 07 2017 00:45
I use homebrew
Aizaz Shahid
@aizazshahid
May 07 2017 00:45
@kerafyrm02 got it !
kerafyrm02
@kerafyrm02
May 07 2017 00:46
Best thing apple has.
Aizaz Shahid
@aizazshahid
May 07 2017 00:46
what's the system hardware specification of yours ?
how much ram or etc needed !
kerafyrm02
@kerafyrm02
May 07 2017 00:48
Model Name: MacBook Pro
      Model Identifier: MacBookPro11,4
      Processor Name: Intel Core i7
      Processor Speed: 2.2 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 6 MB
      Memory: 16 GB
/usr/sbin/system_profiler SPHardwareDataType
Aizaz Shahid
@aizazshahid
May 07 2017 00:49
@kerafyrm02 how much price ?
kerafyrm02
@kerafyrm02
May 07 2017 00:50
A little more than 2k.
Aizaz Shahid
@aizazshahid
May 07 2017 00:50
hahha :D
joking ?
kerafyrm02
@kerafyrm02
May 07 2017 00:50
Can handle 4k videos.
Nah.. almost all macbook pros are 2k
Aizaz Shahid
@aizazshahid
May 07 2017 00:50
much expensive !
kerafyrm02
@kerafyrm02
May 07 2017 00:50
I got this one last yr
It's worth it.
Battery life is so much better.
It doesn't overheat.
Smooth keyboard / mousepad.
Aizaz Shahid
@aizazshahid
May 07 2017 00:52
yeah overheat is a big problem !
kerafyrm02
@kerafyrm02
May 07 2017 00:52
Super fast boot up.
Uses unix.
Dovydas Stirpeika
@Giveback007
May 07 2017 00:54
if (allowed() == 'celebrate') { return 'YAY I JUST FINISHED THE INTERM ALGO CHALANGES!!!'; }
Kristina
@twiggypb
May 07 2017 00:54
??

function nextInLine(arr, item) {
  // Your code here
  testArr.push(item);
  testArr.shift();
  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));
Instructions: 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.
Aizaz Shahid
@aizazshahid
May 07 2017 00:55
@twiggypb you need to use arguments in your function, don't use global variables.
Kristina
@twiggypb
May 07 2017 00:56
:/
```

function nextInLine(arr, item) {
  // Your code here
  var arr1;
  arr1.push(item);
  arr1.shift();
  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));
Aizaz Shahid
@aizazshahid
May 07 2017 00:57
@twiggypb you arguments are arr, item use them, don't create new ones !
Dovydas Stirpeika
@Giveback007
May 07 2017 00:57
@twiggypb I noticed a lot of people get stuck on this one
Kristina
@twiggypb
May 07 2017 00:57
I have tried using it with just arr and the test cases still don’t work.
Dovydas Stirpeika
@Giveback007
May 07 2017 00:58
what's the name of this one?
Kristina
@twiggypb
May 07 2017 00:58
Stand in Line
Aizaz Shahid
@aizazshahid
May 07 2017 00:58
@twiggypb show that code where you use arr.push(item);
Moisés Man
@moigithub
May 07 2017 00:58
ur function returning the original item @twiggypb
should return the removed element
Aizaz Shahid
@aizazshahid
May 07 2017 00:59
@twiggypb .shift() removes the first item and also return it, so you need to return that removed element !
Dovydas Stirpeika
@Giveback007
May 07 2017 00:59
i remeber I was stuck on this one. people get hung up on the description of queue
Aizaz Shahid
@aizazshahid
May 07 2017 01:00
@Giveback007 actually they are right, they only should to make you understand not just give the code !
Kristina
@twiggypb
May 07 2017 01:00
This works, but is it correct?

function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  item = arr.shift();
  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));
Aizaz Shahid
@aizazshahid
May 07 2017 01:01
if you will not think on the code which is using, then it will go to waste.
Dovydas Stirpeika
@Giveback007
May 07 2017 01:01

@twiggypb use this link:
https://www.w3schools.com/jsref/jsref_obj_array.asp

find the array methods that pop() shift() push() unshift()

Aizaz Shahid
@aizazshahid
May 07 2017 01:01
@twiggypb hmm actually you don't need to store it just return arr.shift()
Dovydas Stirpeika
@Giveback007
May 07 2017 01:02
see what each of them do and you will understand right away.
at the time JS wasn't clicking for me, but this reference helped a lot for this and all other JS stuff
Aizaz Shahid
@aizazshahid
May 07 2017 01:02
@twiggypb use variables, whenever you need that statement which you are trying to store in that variable if wants to use more than once !
Kristina
@twiggypb
May 07 2017 01:03
Thanks @forwebtech @Giveback007
CamperBot
@camperbot
May 07 2017 01:03
twiggypb sends brownie points to @forwebtech and @giveback007 :sparkles: :thumbsup: :sparkles:
:cookie: 436 | @forwebtech |http://www.freecodecamp.com/forwebtech
:cookie: 297 | @giveback007 |http://www.freecodecamp.com/giveback007
Dovydas Stirpeika
@Giveback007
May 07 2017 01:04
@twiggypb click on the link for each of them there are very simple examples, much easier to understand than Mozilla dev website
Vamp
@the-vampiire
May 07 2017 01:04
@kerafyrm02 @forwebtech I dont understand this change type=“passwords” thing you guys ar talking about. logged out of facebook to try it out
Aizaz Shahid
@aizazshahid
May 07 2017 01:05
@the-vampiire did you see those ******** in your store passwords like we save it
in the inputs !
Dovydas Stirpeika
@Giveback007
May 07 2017 01:07

I want to brag to someone so bad... but my family doesn't understand if I try to explain this stuff to them. I just finished the intermediate algorithm challenges, I'm very exited.

Will anyone celebrate with me?

Aizaz Shahid
@aizazshahid
May 07 2017 01:07
image.png
Vamp
@the-vampiire
May 07 2017 01:07
@forwebtech ya I see them
where are you changing the type?
Aizaz Shahid
@aizazshahid
May 07 2017 01:08
so if you change the type="password" to text from browser inspect tools then you can see the password too !
Vamp
@the-vampiire
May 07 2017 01:08
@Giveback007 :clap: :beers:
Mike Huynh
@MeowMikao
May 07 2017 01:08

function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
switch (val) {
  case 1:
    console.log("alpha");
    break;
  case 2:
    console.log("beta");
    break;
  case 3:
    console.log("gamma");
    break;
  case 4:
    console.log("delta");
    break;
 }


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

// Change this value to test
caseInSwitch(1);
Dovydas Stirpeika
@Giveback007
May 07 2017 01:08
@the-vampiire @HeebieGeeBee thank you!!! :D
CamperBot
@camperbot
May 07 2017 01:08
giveback007 sends brownie points to @the-vampiire and @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 359 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
:star2: 1583 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Mike Huynh
@MeowMikao
May 07 2017 01:08
i have no idea what im doing wrong D:
Vamp
@the-vampiire
May 07 2017 01:08
@forwebtech I right click in the password box and hit inspect element. nowhere there does it say type = passwords
Aizaz Shahid
@aizazshahid
May 07 2017 01:08
just change the type to text !
Mike Huynh
@MeowMikao
May 07 2017 01:09
wait what?!
Vamp
@the-vampiire
May 07 2017 01:10
Screen Shot 2017-05-06 at 9.09.46 PM.png
this does not allow me to change anything
Aizaz Shahid
@aizazshahid
May 07 2017 01:10

@HeebieGeeBee

foo( [1, 2, 3], [5, 2, 1, 4] )

i need to make it combined in one array into my function by using through arguments ?

@the-vampiire don't change css change the html
Dovydas Stirpeika
@Giveback007
May 07 2017 01:11

@forwebtech if you are ever stuck on array methods try this link https://www.w3schools.com/jsref/jsref_obj_array.asp

it helped me a lot

Vamp
@the-vampiire
May 07 2017 01:12
@forwebtech holy shit
thats terrifying
Screen Shot 2017-05-06 at 9.12.14 PM.png
Aizaz Shahid
@aizazshahid
May 07 2017 01:13
@Giveback007 :+1:
Vamp
@the-vampiire
May 07 2017 01:13
anyone can do this…?
what the fuck
Aizaz Shahid
@aizazshahid
May 07 2017 01:13
@the-vampiire listen but that's only for you pc
Vamp
@the-vampiire
May 07 2017 01:13
oh
well how does it know
Aizaz Shahid
@aizazshahid
May 07 2017 01:13
it can't be done remotely !
Dovydas Stirpeika
@Giveback007
May 07 2017 01:13
@forwebtech I guess I misjudged the scope of your question
sry
Aizaz Shahid
@aizazshahid
May 07 2017 01:14
@Giveback007 what question ?
Dovydas Stirpeika
@Giveback007
May 07 2017 01:14

@HeebieGeeBee

foo( [1, 2, 3], [5, 2, 1, 4] )

i need to make it combined in one array into my function by using through arguments ?

Aizaz Shahid
@aizazshahid
May 07 2017 01:14
@the-vampiire have know that already but @kerafyrm02 remined me !
@Giveback007 @HeebieGeeBee
want to make that like: [1, 2, 3, 5, 2, 1, 4] into one array from arguments object !
Vamp
@the-vampiire
May 07 2017 01:15
@Giveback007 you can concatinate two arrays, is that what you mean?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:15
return Array.from(arguments).reduce((a,b) => a.concat(b));
Vamp
@the-vampiire
May 07 2017 01:15
^^^
Masaki
@masaki1223
May 07 2017 01:16

function chunkArrayInGroups(arr, size) {
  // Break it up.
  var result=[];
  for(var i=0;i<arr.length;){
    result.push(arr.slice(i,i+size));
    i=+size;
  }
  return result;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Why does this become infinite loop????
Vamp
@the-vampiire
May 07 2017 01:16
arguments is an “array like object” but as far as I know the only array property you can use on it is .length
Aizaz Shahid
@aizazshahid
May 07 2017 01:16
@HeebieGeeBee without reduce like Array.from(...arguments) something like that !!
Dovydas Stirpeika
@Giveback007
May 07 2017 01:16
@the-vampiire yes.
Vamp
@the-vampiire
May 07 2017 01:16
@HeebieGeeBee just answere the question for you @Giveback007
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:16
@forwebtech why without reduce?
Dovydas Stirpeika
@Giveback007
May 07 2017 01:17
@the-vampiire I'm in over my head :D
Aizaz Shahid
@aizazshahid
May 07 2017 01:17
because it looks weird ? :) just kidding, thanks buddy @HeebieGeeBee
CamperBot
@camperbot
May 07 2017 01:17
forwebtech sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1584 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Vamp
@the-vampiire
May 07 2017 01:17
I guess you could loop through each array and subarray and push the values out but you’d need to know what dimension the arguments array is..
@Giveback007 let me break it down for you then
Aizaz Shahid
@aizazshahid
May 07 2017 01:17
@the-vampiire yes that's the solution but also we can do with .reduce()
Vamp
@the-vampiire
May 07 2017 01:18
@forwebtech reduce is the way to go, I was answering your question of how to do it without reduce
so you have arguments, this is an array LIKE object, but it is not an array
so your first step is to make an array from arguments
Aizaz Shahid
@aizazshahid
May 07 2017 01:18
@the-vampiire i see !
@the-vampiire yes, Array.from(arguments) do that first
Vamp
@the-vampiire
May 07 2017 01:18
var arr = Array.from(arguments);
this can all be done more concisely im just breaking it into steps so it doesnt look as daunting to you @Giveback007
so now you have an array of arrays stored in ‘arr'
Aizaz Shahid
@aizazshahid
May 07 2017 01:19
@the-vampiire but am wondering if any method like:
var arr = Array.from([...arguments]);
to do that job !
Dovydas Stirpeika
@Giveback007
May 07 2017 01:19

@the-vampiire

@forwebtech holy shit
thats terrifying

i saw you post this and was no longer sure if I knew what the question was

is this for an algo chalange? which one

Vamp
@the-vampiire
May 07 2017 01:20
you can concatinate these arrays useind an array method called reduce
Aizaz Shahid
@aizazshahid
May 07 2017 01:20
@Giveback007 that was private discussion.
Aizaz Shahid
@aizazshahid
May 07 2017 01:20
@the-vampiire @HeebieGeeBee gave the solution !
Dovydas Stirpeika
@Giveback007
May 07 2017 01:20
@forwebtech sorry, i put my nose in
Aizaz Shahid
@aizazshahid
May 07 2017 01:20
:+1:
Vamp
@the-vampiire
May 07 2017 01:21
I know he did I am breaking down @HeebieGeeBee solution because @Giveback007 said he was in over his head after he saw it
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:21
return [...arguments].reduce((a,b) => a.concat(b)); can use the spread if you want
David Amanze
@GodKingShogun
May 07 2017 01:22
@HeebieGeeBee hello son of batman lol
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:22
@GodKingShogun howdy
Dovydas Stirpeika
@Giveback007
May 07 2017 01:22
@the-vampiire tnx, but I think I'm just tired. I stayed up last night working on the algos, and was trying to finished them today with only 5 hours of sleep.
CamperBot
@camperbot
May 07 2017 01:22
giveback007 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:warning: giveback007 already gave the-vampiire points
Aizaz Shahid
@aizazshahid
May 07 2017 01:22
@the-vampiire am thinking you are telling me !
Vamp
@the-vampiire
May 07 2017 01:23
var arr = Array.from(arguments); // you now have an array of arrays pulled from the arguments that were passed to your function

arr = arr.reduce(function(a,b){
     return a.concat(b); 
});

// this step uses the array method ‘reduce’ to concatinate each sub array. 
// it will iterate through the entire array ‘arr’ and concatinate each sub-array (element)
// ‘a’ being the first element, ‘b’ being the next element and continue this process until it reaches the end of the array ‘arr'
David Amanze
@GodKingShogun
May 07 2017 01:24
anyone know how i can get my bootstrap buttons to not expand or to be expanded at the start for my tic tac toe game. as it is right now they are small and when you click on it it grows and makes the board disproportionate. I have tried using container="body" which is what the document wanted me to do but with no avail
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:25
i dislike bootstrap so dont use it much
Dovydas Stirpeika
@Giveback007
May 07 2017 01:25

do any of you use websites like https://www.codewars.com/ or something

to keep advancing after finishing the algo challenges?
Those algos were extremely addicting.

David Amanze
@GodKingShogun
May 07 2017 01:25
@HeebieGeeBee what would you use as a substitute
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:26
@Giveback007 theres lots of places to do algorithm challenges
Aizaz Shahid
@aizazshahid
May 07 2017 01:26
@HeebieGeeBee i think for simple sites BS is really good, what do you say ?
Dovydas Stirpeika
@Giveback007
May 07 2017 01:26
@GodKingShogun check this out incase you want to forgoe a framework
https://www.taniarascia.com/you-dont-need-a-framework/
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:26
@GodKingShogun id just write the code myself as best i could
Vamp
@the-vampiire
May 07 2017 01:26
@Giveback007 now you can follow this process to learn how it is working by doing this
arr = arr.reduce(function(a,b){
    console.log('element a: ', a);
    console.log('element b: ', b);
   return a.concat(b);
});

console.log(arr);
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:26
@forwebtech not realy much interest in building whole sites to be honest
but yeah im sure it has its benefits
but i just dont use it so wouldnt be best to help @GodKingShogun
and the only thing i really used it for before was its grid system, but now theres flexbox
Aizaz Shahid
@aizazshahid
May 07 2017 01:28
i broke the tradition in making my portfolio, wait i need to update it first !
no BS !
Vamp
@the-vampiire
May 07 2017 01:29
@Giveback007 so what it is doing is concatinating a (first element) with b (next element) then returning a (the now concatinated array) to concatinate with the next element (b) until it reaches the end. reduce does not mutate the original array - it returns an array that has been reduced. this is why you would need to either reassign arr = reduced array or a new variable = reduced array to make use of it

@Giveback007

var arr = [[1,2], [3,4], [5,6]];

console.log('original array: ', arr);

arr = arr.reduce(function(a,b){
    console.log('elem a: ', a);
    console.log('elem b: ', b);
   return a.concat(b);
});

console.log('reduced array: ', arr);

output:

// original array:  [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
// elem a:  [ 1, 2 ]
// elem b:  [ 3, 4 ]
// elem a:  [ 1, 2, 3, 4 ]
// elem b:  [ 5, 6 ]
// reduced array:  [ 1, 2, 3, 4, 5, 6 ]
kerafyrm02
@kerafyrm02
May 07 2017 01:32
I'm back..
At coffee shop now.
girlfriend is having a sip & swap with her girlfriends.
Aizaz Shahid
@aizazshahid
May 07 2017 01:33
http://forweb.base.pk/ please visit my portfolio (under construction indeed), but that's fully responsive now without using media query / BS !
@HeebieGeeBee
Dovydas Stirpeika
@Giveback007
May 07 2017 01:33
@the-vampiire I'm going to go digest all of this in code pen now
Masaki
@masaki1223
May 07 2017 01:34

function chunkArrayInGroups(arr, size) {
  // Break it up.
  var result=[];
  for(var i=0;i<arr.length;){
    result.push(arr.slice(i,size));
    i=+size;
  }
  return result;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
What's wrong with this?
Vamp
@the-vampiire
May 07 2017 01:34
okay I put an extra log in there to make it easier to follow
var arr = [[1,2], [3,4], [5,6]];

console.log('original array: ', arr);

var i = 0;

arr = arr.reduce(function(a,b){

    if(i === 0) {
        console.log('elem a: ', a);
        console.log('elem b: ', b);
    }

    if(i === 1) {
        console.log('returned elem a: ', a);
        console.log('next b: ', b);
    }

    i++;
   return a.concat(b);
});

console.log('reduced array: ', arr);


// original array:  [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
// elem a:  [ 1, 2 ]
// elem b:  [ 3, 4 ]
// returned elem a:  [ 1, 2, 3, 4 ]
// next b:  [ 5, 6 ]
// reduced array:  [ 1, 2, 3, 4, 5, 6 ]
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:34
@forwebtech looking nice
Vamp
@the-vampiire
May 07 2017 01:35
@forwebtech very smooth but where’s the projects?!
sometimes I regret making my portfolio appeal to myself rather than anyone with an eye for aesthetics lol
I think it looks cool as hell because I love halloween but everyone I’ve showed it to (shameless friends) have shit on it
@kerafyrm02 great. now go solve “no repeats please” mr. genius
you have 1 hour. good luck
kerafyrm02
@kerafyrm02
May 07 2017 01:37
No repeats?
Which one is that?
Vamp
@the-vampiire
May 07 2017 01:37
the hardest of the hard algos
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:37
@masaki1223 need slice(i, i+size)
Dovydas Stirpeika
@Giveback007
May 07 2017 01:38
@the-vampiire I feel very grateful that you put in this much effort to explain something to me, thank you
CamperBot
@camperbot
May 07 2017 01:38
giveback007 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:warning: giveback007 already gave the-vampiire points
Vamp
@the-vampiire
May 07 2017 01:38
@Giveback007 youre welcome…you could say I was…giving back
:sunglasses:
kerafyrm02
@kerafyrm02
May 07 2017 01:39
Oh neat.. Cool puzzle.
Vamp
@the-vampiire
May 07 2017 01:39
cool puzzle he says
50% of those who attempt it never make it out alive
Dovydas Stirpeika
@Giveback007
May 07 2017 01:39
on only 10% of those who do have all their limbs in tact
Vamp
@the-vampiire
May 07 2017 01:39
they say there are still some out there mumbling permutations to themselves as they rock in a corner
kerafyrm02
@kerafyrm02
May 07 2017 01:40
Does seem tricky.
Aizaz Shahid
@aizazshahid
May 07 2017 01:40
@the-vampiire as i said, under construction !
Dovydas Stirpeika
@Giveback007
May 07 2017 01:40
I'm about 36% certain that these statistics are acurate
Vamp
@the-vampiire
May 07 2017 01:40
I know it’s hard because @forkerino said it was hard and he’s a fockin genius
you have 54 minutes remaining @kerafyrm02
Dovydas Stirpeika
@Giveback007
May 07 2017 01:41
no hese a forken genius it is in his name
Vamp
@the-vampiire
May 07 2017 01:41
lol
Aizaz Shahid
@aizazshahid
May 07 2017 01:41
@the-vampiire did you resize the browser on my site ?
kerafyrm02
@kerafyrm02
May 07 2017 01:41
Reading up on what permutations are lol.
Aizaz Shahid
@aizazshahid
May 07 2017 01:41
if not then check it once !
Vamp
@the-vampiire
May 07 2017 01:42
lets pair prgoram it @kerafyrm02. and by pair program I mean let me ride your back like a 40lb child whispering useless information in your ear
Chaitanya thakre
@Chaitanya009
May 07 2017 01:42

`
function fearNotLetter(str) {
var arr = [];
for(var i=0;i<str.length;i++){
arr.push(str.charCodeAt(i));
}
for(var j=0;j<arr.length;j++){
if(arr[j]+1!==arr[j+1]){
return String.fromCharCode(arr[j]+1);
}
else return undefined;
}
}

fearNotLetter("abce");`

Vamp
@the-vampiire
May 07 2017 01:42
Screen Shot 2017-05-06 at 9.42.25 PM.png
@forwebtech
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:43
its the hardest algorithm that free code camp have i think
Aizaz Shahid
@aizazshahid
May 07 2017 01:43
@the-vampiire jS power !
Vamp
@the-vampiire
May 07 2017 01:43
im going for a walk with the dogs. be back in an hour or so fellows. I expect a screenshot of a big green checkmark on my desk when I return @kerafyrm02
kerafyrm02
@kerafyrm02
May 07 2017 01:43
lol Vamp
Aizaz Shahid
@aizazshahid
May 07 2017 01:43
:)
Keon Samuel
@keonsam
May 07 2017 01:43
@HeebieGeeBee which one?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:43
no repeats please
Dovydas Stirpeika
@Giveback007
May 07 2017 01:44
@HeebieGeeBee I'm gona try it. If I don't make it back let my wife know that I love her
Chaitanya thakre
@Chaitanya009
May 07 2017 01:44
can anyone help me?
Keon Samuel
@keonsam
May 07 2017 01:44
definitely
Dovydas Stirpeika
@Giveback007
May 07 2017 01:44
@Chaitanya009 we all need help sometimes
Chaitanya thakre
@Chaitanya009
May 07 2017 01:45

function fearNotLetter(str) {
var arr = [];
for(var i=0;i<str.length;i++){
arr.push(str.charCodeAt(i));
}
for(var j=0;j<arr.length;j++){
if(arr[j]+1!==arr[j+1]){
return String.fromCharCode(arr[j]+1);
}
else return undefined;
}
}

fearNotLetter("abce");

not passing the test
Dovydas Stirpeika
@Giveback007
May 07 2017 01:46
@Chaitanya009 what is one of the test cases supose to output
it should return d else undefined
Dovydas Stirpeika
@Giveback007
May 07 2017 01:48
fix this:
else return undefined;
else {
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:49
@Chaitanya009 you need to return undefined outside the loop, and you need to write in a caveat to your if statement, that i is not on the last iteration
otherwise its just gonna return the next letter in the chain
Chaitanya thakre
@Chaitanya009
May 07 2017 01:51
@HeebieGeeBee like this
function fearNotLetter(str) {
  var arr = [];
  for(var i=0;i<str.length;i++){
    arr.push(str.charCodeAt(i));
  }
  for(var j=0;j<arr.length;j++){
    if(arr[j]+1!==arr[j+1]){
      return String.fromCharCode(arr[j]+1);
    }
  }
  return undefined;
}

fearNotLetter("abce");
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:51
actually you could just change your loop condition
yes now just make it so you dont iterate the loop on the last letter of the string
Chaitanya thakre
@Chaitanya009
May 07 2017 01:53
@HeebieGeeBee thanks
CamperBot
@camperbot
May 07 2017 01:53
chaitanya009 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1585 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Dovydas Stirpeika
@Giveback007
May 07 2017 01:54
@HeebieGeeBee you guys are always so fast at reading other peoples code
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:54
@Chaitanya009 btw undefined is the default for a return, so you dont actually have to write return undefined, just simple putting return will do
Dovydas Stirpeika
@Giveback007
May 07 2017 01:54
@HeebieGeeBee I was still trying to work trough it and you already have an asnwer
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:55
@Giveback007 sorry
it gets better the more you do it
Dovydas Stirpeika
@Giveback007
May 07 2017 01:55
@HeebieGeeBee nothing to be sorry at, I'm trying to refine the skill or reading code. It's easier to write code than it is to read it
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:55
i still think im pretty bad though
DistinctWolf
@DistinctWolf
May 07 2017 01:56
@HeebieGeeBee how long have you been coding
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:56
since mid december
Dovydas Stirpeika
@Giveback007
May 07 2017 01:56
I was looking at my solution to compare but everyone writes so difrently
function fearNotLetter(str) {
  var first = str.charCodeAt();
  for (var i = 0; i < str.length; i++) {
    if (first !== str.charCodeAt([i])) { 
      return String.fromCharCode(first); 
    }
    first++;
  }
  return;
}

fearNotLetter("abce");
HeebieGeeBee
@HeebieGeeBee
May 07 2017 01:57
3 backticks on their own line @Giveback007
at the beginning and at the end
Dovydas Stirpeika
@Giveback007
May 07 2017 01:58
@HeebieGeeBee NICE!
for previously written stuff I don't even understand my own code unless I stare at it for at least 10 minutes
Maximino V. Jardin III
@ma5one1
May 07 2017 02:05
Halp!

var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = filt;
var filt = oldArray.filter(function(val){
return val > 5;
});
console.log(newArray);
// console.log(filt);

Dovydas Stirpeika
@Giveback007
May 07 2017 02:05
oh see just now, i got it
that's 8 minutes
J9guy
@J9guy
May 07 2017 02:05
Could someone help me with this, I'm getting this error.
whoops
hagn on

TypeError: Cannot read property 'split' of undefined

function palindrome(str) {
if(str.lowercase.split(' ').reverse.join === str.lowercase){
return true;
}
else{
return false;
}
}

var hsf = "A man, a plan, a canal. Panama";

palindrome("not a palindrome");

kickkick479
@kickkick479
May 07 2017 02:08
@ma5one1 Want to return an array including only numbers bigger than 5?
I think var newArray = filt; does not make sense. Fix that like this var newArray = oldArray.filter
Dovydas Stirpeika
@Giveback007
May 07 2017 02:08
@ma5one1 you are calling the function and assigning it to newArray before it is parsed
var oldArray = [1,2,3,4,5,6,7,8,9,10];
// Only change code below this line.

var filt = oldArray.filter(function(val){
return val > 5;
});
var newArray = filt;
console.log(newArray);
// console.log(filt);
this runs
kickkick479
@kickkick479
May 07 2017 02:09
@J9guy str.lowercase
There is no lowercase(). Use toLowerCase()
J9guy
@J9guy
May 07 2017 02:09
thanks
Dovydas Stirpeika
@Giveback007
May 07 2017 02:09

@J9guy if you are ever not sure check this out first

https://www.w3schools.com/jsref/jsref_obj_array.asp

kickkick479
@kickkick479
May 07 2017 02:10
@J9guy Besides, join need () . Maybe also it need some arguments.
Maximino V. Jardin III
@ma5one1
May 07 2017 02:10
thanks @kickkick479
CamperBot
@camperbot
May 07 2017 02:10
:cookie: 348 | @kickkick479 |http://www.freecodecamp.com/kickkick479
ma5one1 sends brownie points to @kickkick479 :sparkles: :thumbsup: :sparkles:
Maximino V. Jardin III
@ma5one1
May 07 2017 02:11
thanks @Giveback007
CamperBot
@camperbot
May 07 2017 02:11
ma5one1 sends brownie points to @giveback007 :sparkles: :thumbsup: :sparkles:
:cookie: 298 | @giveback007 |http://www.freecodecamp.com/giveback007
kickkick479
@kickkick479
May 07 2017 02:11
@ma5one1 :+1:
Dovydas Stirpeika
@Giveback007
May 07 2017 02:12
@J9guy your lowercase function doesn't work like that
@kickkick479 ahh you already answered it
Sean Hoar
@SHoar
May 07 2017 02:13
@J9guy join needs to have a () with a character to place on the join... same with reverse also, are you accounting for the special characters with regexp?
Viknesh
@vk2mars
May 07 2017 02:14
Hello can someone please help me with Exact change? The float imprecision is throwing me off and i can't seem to figure out how to fix it.
function checkCashRegister(price, cash, cid) {
  var needed = cash - price;
  var available = cid.reduce(
    function(a,v){
      return a + v[1];
    },0);


  if(available < needed ){
    return "Insufficient Funds";
  }

  if(needed == available){
    return "Closed";
  }
  // Here is your change, ma'am.
  var currencyValues = [0.01,0.05,0.10,0.25,1.00,5.00,10.00,20.00,100.00];


  function biggestBill(needed,cid){
    //Find possible bills that fit the bill
    var goodBills = currencyValues.filter(function(val){return val<=needed;});
    // Whats the best bill?
    function bigly(a,b){return Math.max(a, b);}

    var highestBill = goodBills.reduce(bigly);
    //Check and adjust for presence in cid

    while(cid[currencyValues.indexOf(highestBill)][1] === 0){

      if(highestBill === 0.01){
        return 0.01;
      }
      goodBills.pop();
        highestBill = goodBills.reduce(bigly);

      }

    return highestBill;
  }


  var change = [];
  while(needed > 0){
    //Find the largest possible bill
    var bigBill = biggestBill(needed,cid);
    var numBill = Math.floor(needed/bigBill);
    var billsToCurr = bigBill*numBill;
    //Use it
    needed = needed - billsToCurr;
    //Account for the subraction
    var index = currencyValues.indexOf(bigBill);
    cid[index][1] = cid[index][1] - billsToCurr;
    change.push([cid[index][0],billsToCurr]);

  }

  return change;
Dovydas Stirpeika
@Giveback007
May 07 2017 02:16
@the-vampiire @HeebieGeeBee can you guys look at @vk2mars code
avengers unite!
HeebieGeeBee
@HeebieGeeBee
May 07 2017 02:17
@vk2mars times all the numbers by 100 to make them whole numbers, then before you return any of them divide them by 100
Viknesh
@vk2mars
May 07 2017 02:18
@HeebieGeeBee ok i'll try that and get back to you
HeebieGeeBee
@HeebieGeeBee
May 07 2017 02:19
@vk2mars you need to do it in your available variable especially
Alan Saber
@Alan95
May 07 2017 02:19
http://codepen.io/BearCoding/pen/xdXevN?editors=1011 why do i get an infinite loop if no one is winning and i am getting on the last field? (cannot click last field if its going to be a dive). pls open new window for my project else window does not display. thx!
Damien
@DubbDevs
May 07 2017 02:20
so I'm attempting to do the lookup profile challenge...and I need some help please
Viknesh
@vk2mars
May 07 2017 02:20
@HeebieGeeBee available = Math.ceil(available*100)/100;
Damien
@DubbDevs
May 07 2017 02:21
this is sadly my 3rd day attempting this.
 var nameExist = false;

 for (var i = 0; i < contacts.length; i++)
   if (firstName === contacts[i]) {
     nameExist = true;
   } else if (contacts.hasOwnProperty(prop)) {
     nameExist = true;
   } else  (nameExist = false); {
     return "No Such property";}}


   if (nameExist = true); {
    return (firstName, prop);
  } else {
    return "No such name";
Vamp
@the-vampiire
May 07 2017 02:21
@vk2mars I explained it to you earlier...use Number(variable_name.toFixed(2))
Damien
@DubbDevs
May 07 2017 02:21
am I even remotely close
HeebieGeeBee
@HeebieGeeBee
May 07 2017 02:21
@vk2mars well i meant in the reduce function
DistinctWolf
@DistinctWolf
May 07 2017 02:22
How do you refer to the true value and 'true' in javascript
Vamp
@the-vampiire
May 07 2017 02:22
toFixed(number of decimals) will truncate to the designated decimal place. However it returns a string. You need an integer value. So you wrap that in Number() to convert it to an integer
This returns an integer, it does not mutate the string itself. So you have to assign it to a variable. Example: total = Number(total.toFixed(2)); now total will hold an integer value truncated to 2 decimal places
Onam Guerra
@fizzif
May 07 2017 02:25
Can anyone tell me why
strokes = par - 1 works but strokes <= par - 2 doesn't?
Alan Saber
@Alan95
May 07 2017 02:31
@DubbDevs u are missing a "{" after starting ur for loop, and if (nameExist = true); should be without the comma
Damien
@DubbDevs
May 07 2017 02:33
ummm let me go check that @Alan95
Alan Saber
@Alan95
May 07 2017 02:34
@DubbDevs for (var i = 0; i < contacts.length; i++) { } and u dont need ";" after else or if (i see 2 in the code)
Alexey Zamsheen
@jeranimo
May 07 2017 02:35
Hi, everyone! I have problem with task #216
Here is my attempt of solution:

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


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

// Change these values to test your function
lookUpProfile("Sherlock", "likes");
But as input I'm getting values of only the first object (((
max#237
@maximilientoumi
May 07 2017 02:38

function golfScore(par, strokes) {
// Only change code below this line
if (strokes>= par +3) {

return "Go Home!";

}
if (strokes=== par +2) {

return "Double Bogey";

}
if (strokes===par +1) {

return "Bogey";

}
if (strokes=== par ) {

return "Par";

}
if (strokes=== par -1) {

return "Birdie";

}
if(strokes<= par- 2) {

return "Eagle";

}
if (strokes===1){

return "Hole-in-one!"

}

return "Change Me";
// Only change code above this line
}

Alexey Zamsheen
@jeranimo
May 07 2017 02:39
And what is more interesting, if i'm deleting all "else if" statements and left only the first "if" I can reach any oject In accordance with the specified parameters...
Please HELP!!!
max#237
@maximilientoumi
May 07 2017 02:39
help i am getting errors at
golf game
Alan Saber
@Alan95
May 07 2017 02:46
@jeranimo ur problem is that if the first statement is false, the function breaks since u return a value
Dovydas Stirpeika
@Giveback007
May 07 2017 02:47

hey how do you use

replace(/stuff/g, '')

if stuff = '()'

replace(/(|)/g, '')

doesn't work

Vamp
@the-vampiire
May 07 2017 02:49
use escape character \
str.replace(/\(\(|\))/g, '');
@Giveback007
in regex if you need to use a character that already has a purpose in regex (called a meta-character) you need to escape it.
Dovydas Stirpeika
@Giveback007
May 07 2017 02:52
@the-vampiire what is regex?
Alexey Zamsheen
@jeranimo
May 07 2017 02:52
@Alan95 Thanks a lot!!! I think I get the point... I hope so...
Vamp
@the-vampiire
May 07 2017 02:52
? . [ ] ( ) are a few metacharacters that must be escaped
CamperBot
@camperbot
May 07 2017 02:52
jeranimo sends brownie points to @alan95 :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @alan95 |http://www.freecodecamp.com/alan95
Vamp
@the-vampiire
May 07 2017 02:53
@Giveback007 regex is short for Regular Expression (RegEx) it is what you are passing as the first argument to the replace method
Dovydas Stirpeika
@Giveback007
May 07 2017 02:53
@the-vampiire thank you
CamperBot
@camperbot
May 07 2017 02:53
giveback007 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 360 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Vamp
@the-vampiire
May 07 2017 02:54
it can appear very confusing and alien but if you put some time into understanding the basics of RegEx it is actually pretty straightforward to build the expressions
Aizaz Shahid
@aizazshahid
May 07 2017 02:54
@HeebieGeeBee done my symmetric difference. https://repl.it/HkVf/15
@the-vampiire
Dovydas Stirpeika
@Giveback007
May 07 2017 02:54
@the-vampiire
(/\(|\)/g, '')
Dovydas Stirpeika
@Giveback007
May 07 2017 02:55
why is this not working like that?
Vamp
@the-vampiire
May 07 2017 02:55
there are a couple of string methods tht make use of regex including replace and match
for testing regular expressions. great tool while you practice
well what are you trying to replace
| is the OR metacharacter in regex
Ken Haduch
@khaduch
May 07 2017 02:56
@maximilientoumi - are you passing any tests?
Dovydas Stirpeika
@Giveback007
May 07 2017 02:57
@the-vampiire yes I want to remove both ()
Vamp
@the-vampiire
May 07 2017 02:57
anywhere in a string?
what is the string
Dovydas Stirpeika
@Giveback007
May 07 2017 02:57
"1 (555) 555-5555"
I could do a work around and just do a seperate statement for each of the ()
Aizaz Shahid
@aizazshahid
May 07 2017 02:58
@Giveback007 remember to use ^ flag at start and $ flag at the end.
Dovydas Stirpeika
@Giveback007
May 07 2017 02:59
but I would like to use the | operator on both escaped characters
@forwebtech a wha... ?
Ken Haduch
@khaduch
May 07 2017 02:59
@khaduch - it looks like you are just missing the "Hole-in-one!" cases - the easiest solution is to test for that first, because you're probably erroneously matching one of the cases in your other tests. Hole-in-one should have priority, anyway - test for that first.
Dovydas Stirpeika
@Giveback007
May 07 2017 02:59
@forwebtech example plz
Vamp
@the-vampiire
May 07 2017 03:00
@Giveback007
var str = 'testing (out) regex to remove (parenthesis).',
    regex = /\(|\)/g;

console.log('str before replace method: ', str, '\n');

str = str.replace(regex, '');

console.log('str after replace method: ', str);

//output:

// str before replace method:  testing (out) regex to remove (parenthesis). 

// str after replace method:  testing out regex to remove parenthesis.
Dovydas Stirpeika
@Giveback007
May 07 2017 03:00
see I only want to remove -()
Vamp
@the-vampiire
May 07 2017 03:01
that’s what I removed..?
Dovydas Stirpeika
@Giveback007
May 07 2017 03:01
right but not in this string 8oo-six427676;laskdjf
Vamp
@the-vampiire
May 07 2017 03:01
@Giveback007
var str = "1 (555) 555-5555",
    regex = /\(|\)/g;

console.log('str before replace method: ', str, '\n');

str = str.replace(regex, '');

console.log('str after replace method: ', str);

// output:

// str before replace method:  1 (555) 555-5555 

// str after replace method:  1 555 555-5555
there are no parenthesis in that string to be replaced
Dovydas Stirpeika
@Giveback007
May 07 2017 03:03
I am going to test if the string has any non number characters after ()- are removed as those are aloved in a phone number
Vamp
@the-vampiire
May 07 2017 03:03
okay
Dovydas Stirpeika
@Giveback007
May 07 2017 03:03
please don't give me other solutions, I want to solve all other parts of the problem myself
Vamp
@the-vampiire
May 07 2017 03:03
I never give solutions
He11aWor1d
@He11aWor1d
May 07 2017 03:03

function golfScore(par, strokes) {
// Only change code below this line
if(strokes==1){
return "Hole-in-one!";
}else if(strokes<=par-2){
return "Eagle";
}else if(strokes==par-1){
return "Birdie";
}else if(strokes == par){
return "par";
}else if(strokes==par+1){
return "Bogey";
}else if(strokes==par+2){
return "Double Bogey";
}else if(strokes>=par+3){
return "Go Home!";
}
else{
return "Change Me";
}

// Only change code above this line
}

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

Vamp
@the-vampiire
May 07 2017 03:04
I didnt know you were working on an algo I thought you were asking in general
He11aWor1d
@He11aWor1d
May 07 2017 03:04
anything goes wrong?
Dovydas Stirpeika
@Giveback007
May 07 2017 03:04
@the-vampiire well the regex is still super useful to know for other future instances so thank you
CamperBot
@camperbot
May 07 2017 03:04
giveback007 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:warning: giveback007 already gave the-vampiire points
Vamp
@the-vampiire
May 07 2017 03:04
@He11aWor1d yes, use a switch case. this is the purpose of the challenge
Aizaz Shahid
@aizazshahid
May 07 2017 03:05
@Giveback007 well if you are making one regex for all then you need to do that
regex = /^your regex ...$/
Vamp
@the-vampiire
May 07 2017 03:05
@Giveback007 I will give you a hint on that problem. it can be solved in a single line if you take the time to learn regex
Joseph
@revisualize
May 07 2017 03:05

Could someone suggest changes to this text:

Stand In Line is a CheckPoint where you're supposed to:
Write a function nextInLine which has two parameters
an array (arr) and a number (item).
That part has been done for you here:

function nextInLine(arr, item) { }

With that function declaration you have a function name of nextInLine. You have two parameters arr which represents an array passed into the function and item that represents a number passed to the function.
A few example function calls:
nextInLine([4,3,2] , 1) the values passed to arr is [4,3,2] and the value passed to item is 1

nextInLine([2,4,6,8] , 10) ... arr is [2,4,6,8] & item is 10

nextInLine([2,3,5,7,11] , 13) ... arr is [2,3,5,7,11] & item is 13 (first 5 and 6th prime numbers)

nextInLine([] , 0) ... arr is [] & item is 0

var myArr = [1,3,5,7]; nextInLine(myArr , 9) ... arr is [1,3,5,7] the same value as the global variable & item is 9

Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).

Again the two parameters for the nextInLine function are arr & item.

Per the instructions: 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.

You need to add the number (item) to the end of an array (arr).
You also need to remove the first element from an array (arr).

Then you need to have your function return the removed element from the array arr.

Ken Haduch
@khaduch
May 07 2017 03:05
@He11aWor1d - check the spelling of "Par" in the expected results.
Daniel Zeff
@Diesirae9
May 07 2017 03:05
Can I ask a quick question?
Aizaz Shahid
@aizazshahid
May 07 2017 03:06
@Giveback007 if multiple then also it should be used
regex = /(^your regex ...$)|((^your second regex ...$)/
@Diesirae9 :D who is stopping you ?
Daniel Zeff
@Diesirae9
May 07 2017 03:06
lol
He11aWor1d
@He11aWor1d
May 07 2017 03:06
@the-vampiire it's a (if/else) mission
Daniel Zeff
@Diesirae9
May 07 2017 03:06
not sure :P
Aizaz Shahid
@aizazshahid
May 07 2017 03:06
@Diesirae9 sure, ask ?
Daniel Zeff
@Diesirae9
May 07 2017 03:06
How does this return a range for me: return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
Ken Haduch
@khaduch
May 07 2017 03:06
@He11aWor1d - yes, just check the spelling of "Par" in your returns, compare it to the expected results.
He11aWor1d
@He11aWor1d
May 07 2017 03:07
@khaduch wow! thank
CamperBot
@camperbot
May 07 2017 03:07
he11awor1d sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2845 | @khaduch |http://www.freecodecamp.com/khaduch
Dovydas Stirpeika
@Giveback007
May 07 2017 03:07
@the-vampiire I just played around with it i get it now, again thank you
CamperBot
@camperbot
May 07 2017 03:07
giveback007 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:warning: giveback007 already gave the-vampiire points
He11aWor1d
@He11aWor1d
May 07 2017 03:07
@khaduch yes yes yes
Aizaz Shahid
@aizazshahid
May 07 2017 03:07
@Diesirae9 Math.random() know its work ??
Vamp
@the-vampiire
May 07 2017 03:07
@He11aWor1d you are right sorry. was thinking of the card counter one
Daniel Zeff
@Diesirae9
May 07 2017 03:07
just seemed right to ask BTW to ask :P
Dovydas Stirpeika
@Giveback007
May 07 2017 03:07
@forwebtech oooh tnx I'm going to try that now
CamperBot
@camperbot
May 07 2017 03:07
giveback007 sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 438 | @forwebtech |http://www.freecodecamp.com/forwebtech
Ken Haduch
@khaduch
May 07 2017 03:08
@He11aWor1d - first thing to do - always compare expected results to the results you are generating - the tests are very exacting in what they expect.
Daniel Zeff
@Diesirae9
May 07 2017 03:08
I know the code works :)
Aizaz Shahid
@aizazshahid
May 07 2017 03:08
@Diesirae9 am answering you but first tell me about Math.random()
what is the functionality ?
Daniel Zeff
@Diesirae9
May 07 2017 03:09
Math.random() sends me a number between 0 and 1
Aizaz Shahid
@aizazshahid
May 07 2017 03:09
yup !
He11aWor1d
@He11aWor1d
May 07 2017 03:09
@khaduch hah, thanks thanks very much
CamperBot
@camperbot
May 07 2017 03:09
he11awor1d sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: he11awor1d already gave khaduch points
Daniel Zeff
@Diesirae9
May 07 2017 03:09
but not quite 1 :)
Aizaz Shahid
@aizazshahid
May 07 2017 03:09
and What Math.floor does ?
Daniel Zeff
@Diesirae9
May 07 2017 03:09
Rounds to the nearest whole number
Aizaz Shahid
@aizazshahid
May 07 2017 03:09
@Diesirae9 very good !
ok now tell me what is stored in myMax and myMin ??
Dovydas Stirpeika
@Giveback007
May 07 2017 03:11

@Giveback007 if multiple then also it should be used

regex = /(^your regex ...$)|((^your second regex ...$)/

I tried this it didn't seem to work

Aizaz Shahid
@aizazshahid
May 07 2017 03:11
@Giveback007 did you put as it is ??
:)
Daniel Zeff
@Diesirae9
May 07 2017 03:11
myMax and myMin are going to be my properties for my from my function.
Aizaz Shahid
@aizazshahid
May 07 2017 03:12
@Diesirae9 but give me some sample numbers so i can tell you
Dovydas Stirpeika
@Giveback007
May 07 2017 03:12

do i

regex =

to define the characters?

Aizaz Shahid
@aizazshahid
May 07 2017 03:12
@Giveback007 and i didn't say, it will work for you but it required !
Daniel Zeff
@Diesirae9
May 07 2017 03:12
randomRange(90, 4000);
Aizaz Shahid
@aizazshahid
May 07 2017 03:13
@Diesirae9 got it !
Daniel Zeff
@Diesirae9
May 07 2017 03:13
OOOOOOOO!
well... I am still wondering how the return actually works but I think I get it...
kinda?
Bryan Reese
@breese8009
May 07 2017 03:14
feel like ive gone down a wrong path....it passes the first two.... I can get the....if it starts with a vowel just ad way...but im having trouble with why glove case is acting the way it is...
function translatePigLatin(str) {
  var firstVow=[];
  var final=[];
  var vowels=['a','e','i','o','u'];
  var arr=str.split('');

  vowels.forEach(function(e){
   if(arr.includes(e)){
 firstVow.push(e);
      console.log(firstVow);
 final=arr.slice(arr.indexOf(firstVow[0]))+arr.slice(arr.indexOf(firstVow[0])-1,1)+   arr.slice(1,arr.indexOf(firstVow[0]));
} 
});

  return final.split(',').join('')+"ay";

}
translatePigLatin("california");
Daniel Zeff
@Diesirae9
May 07 2017 03:17
Does that make sense? lol
No I think I have it!
Bryan Reese
@breese8009
May 07 2017 03:17
@Diesirae9 whats ur question?
Vamp
@the-vampiire
May 07 2017 03:17
@Giveback007 this is not a challenge you will solve by dicking around with regex my man. please trust me - take the time to read the links I sent you. you will understand how to build regex at that point
Daniel Zeff
@Diesirae9
May 07 2017 03:18
I am trying to figure out how:
return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin; actually sends back a range
Vamp
@the-vampiire
May 07 2017 03:18
@Diesirae9 return is how you send OUT of the function. where as parameters (which become arguments when the function is called) are how you send INTO the function
Daniel Zeff
@Diesirae9
May 07 2017 03:19
Is it that is creates my max first, combines myMin, and then picks a random number from there?
kickkick479
@kickkick479
May 07 2017 03:19
@breese8009 What name is that challenge?
Bryan Reese
@breese8009
May 07 2017 03:19
@kickkick479 pigLatin
Vamp
@the-vampiire
May 07 2017 03:20
pig latin
@breese8009 step back for a moment I think you’re overcomplicating it
Aizaz Shahid
@aizazshahid
May 07 2017 03:20
// 90, 4000
=> Math.floor( Math.random() * ( 4000 - 90 + 1 ) ) + 90
=> Math.floor( 0.456793 * ( 4091 ) ) + 90
=> Math.floor(1868.740163 ) + 90
=> 1869 + 90
=> 1959   that is your random number between  90 to 4000
@Diesirae9
Bryan Reese
@breese8009
May 07 2017 03:20
@the-vampiire I know.....i im completely overcomplicating it
Vamp
@the-vampiire
May 07 2017 03:21
@breese8009 it helps on challenges to get in the habit of writing pseudocode. this means to write out in plain english what you want to accomplish and how
Aizaz Shahid
@aizazshahid
May 07 2017 03:21
to generate a random number between a specific range !
Daniel Zeff
@Diesirae9
May 07 2017 03:21
I seeeee!
Aizaz Shahid
@aizazshahid
May 07 2017 03:21
@Diesirae9 done really hard work :laughing:
Bryan Reese
@breese8009
May 07 2017 03:21
@the-vampiire yea u can tell i didnt do that
hense the craziness
lol
Vamp
@the-vampiire
May 07 2017 03:21
I can indeed
Aizaz Shahid
@aizazshahid
May 07 2017 03:22
@Diesirae9 that also a step to understand formulas, precisely !
Daniel Zeff
@Diesirae9
May 07 2017 03:22
yeah!
Vamp
@the-vampiire
May 07 2017 03:23
@breese8009 so go ahead and write out the pseudocode. ill guide you from there if youd like
Daniel Zeff
@Diesirae9
May 07 2017 03:23
actually putting in the params to see how it is executing! :)
Thanks @forwebtech
CamperBot
@camperbot
May 07 2017 03:23
diesirae9 sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 439 | @forwebtech |http://www.freecodecamp.com/forwebtech
Bryan Reese
@breese8009
May 07 2017 03:23
@the-vampiire ok, imma start over.... ill be back
@the-vampiire ty
CamperBot
@camperbot
May 07 2017 03:24
breese8009 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 361 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Daniel Zeff
@Diesirae9
May 07 2017 03:24
@the-vampiire I will try that next time too :)
thanks @the-vampiire
CamperBot
@camperbot
May 07 2017 03:24
diesirae9 sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 362 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Vamp
@the-vampiire
May 07 2017 03:24
@breese8009 Ill give you a hint. its not in the suggested links but you will fid it helpful
see if you can understand how that will be helpful for you. just remember write out the pseudocode completely. read it out loud. if you find any holes in your logic correct them. once that is complete then begin writing code. not a minute sooner or you end up with a convoluted mess
Daniel Zeff
@Diesirae9
May 07 2017 03:25
@forwebtech I was having a hard time just combining the concepts :) seeing it that way was very helpful.... I even had it into a mathematical equation
Bryan Reese
@breese8009
May 07 2017 03:25
@the-vampiire I had that in my code actually
originally
but took it out an went diff route
Vamp
@the-vampiire
May 07 2017 03:26
well
it seems a fitting tool for this job
Bryan Reese
@breese8009
May 07 2017 03:26
for sure
Jonathanwam
@Jonathanwam
May 07 2017 03:26
I need some help understanding what I'm doing wrong with the Palindrome challenge. I think it might be my regex? Not sure. It really seems like it should work. I'm only getting 2/13 tests incorrect.

function palindrome(str) {
  str.toLowerCase();
  str = str.replace(/\s+/g, '');
  str = str.replace(/[^a-z0-9+]+/gi, ''); 
  if(str.length === 0 || str.length === 1) return true;

  var i = 0; var j = str.length - 1;

  while(i <= j) {
    if (str[i] != str[j]) return false;
    i++; j--;
  }

  return true;
}



palindrome("A man, a plan, a canal. Panama");
Daniel Zeff
@Diesirae9
May 07 2017 03:27
@forwebtech z *(x-y + 1) +y
Aizaz Shahid
@aizazshahid
May 07 2017 03:27
@Diesirae9 :+1:
Jonathanwam
@Jonathanwam
May 07 2017 03:28
Oh and ignore the 3rd line (1st line of regex). It doesn't change a thing I was just testing something.
Vamp
@the-vampiire
May 07 2017 03:28
@Jonathanwam I think you should consider the use of the metacharacter ^
also here is a tool for testing regex www.regex101.com
Aizaz Shahid
@aizazshahid
May 07 2017 03:29
@Diesirae9 roundoff( z * (x - y + 1) ) + y that is more appropriate.
Vamp
@the-vampiire
May 07 2017 03:29
oh disregard my first statement. iread your regex wrong
getting late
Jonathanwam
@Jonathanwam
May 07 2017 03:31
@the-vampiire Thanks for the link, it's gonna be useful for sure.
CamperBot
@camperbot
May 07 2017 03:31
jonathanwam sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 363 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Daniel Zeff
@Diesirae9
May 07 2017 03:31
@forwebtech I mentally combined roundoff with z meaning whole integer lol... you need read my mind for that one :P
Aizaz Shahid
@aizazshahid
May 07 2017 03:32
@Diesirae9 well that's why i told you :)
already did that hahaha
but actually the problem is that if you make a formula then you have to define there, that we have to round off like this one: n! / (n-1)!
Vamp
@the-vampiire
May 07 2017 03:33
@Jonathanwam so take anther look at your first line. the string method toLowerCase does not mutate the string it is called on. it returns a string in lowercase. you need to assign this new lowercase string to a variable to make use of it
Aizaz Shahid
@aizazshahid
May 07 2017 03:33
@Diesirae9 here ! showing that it's a factorial.
Vamp
@the-vampiire
May 07 2017 03:33
@Jonathanwam the rest of your code is fine
Jonathanwam
@Jonathanwam
May 07 2017 03:35
@the-vampiire Ah right, totally missed that! That fixed it. Thanks again!
CamperBot
@camperbot
May 07 2017 03:35
jonathanwam sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:warning: jonathanwam already gave the-vampiire points
Vamp
@the-vampiire
May 07 2017 03:35
@Jonathanwam do you see what I mean? I was looking at your code wondering why it wasnt working. overlooked that line. I found out by putting a console log in your loop. it never passed a === A
always use console logs when youre stuck!
best way to ensure something is doing what you expect, and if not you can trace it back to the root of the bug
Daniel Zeff
@Diesirae9
May 07 2017 03:36
I see :) @forwebtech
Jonathanwam
@Jonathanwam
May 07 2017 03:36
For some reason, the console log doesn't work in the freecodecamp UI for me. And I was too lazy to use something else.
Vamp
@the-vampiire
May 07 2017 03:36
@Jonathanwam and one more thing. get in the habit of using strict match === and non match !==
for most cases it wont matter but it will save you headache in the future for the one case where it did matter and you werent using it out of habit
Aizaz Shahid
@aizazshahid
May 07 2017 03:36
@Jonathanwam https://repl.it/languages/JavaScript use this !
to test your JS !
Vamp
@the-vampiire
May 07 2017 03:37
@Jonathanwam I do everything in my own IDE then paste into FCC. I destest the FCC UI it’s terrible for me. plus I get a nice file for each piece of work I do. for simpler ones I have a ‘practice.js’ file that I continuously write and wipe out
Aizaz Shahid
@aizazshahid
May 07 2017 03:37
also my advise is that, first do it on repl and then paste it to FCC .
and also you can make files there like mine one : https://repl.it/HkVf/17
or the best place is your own computer as @the-vampiire suggested !
@Jonathanwam
snoudin
@snoudin
May 07 2017 03:42
help with CHUNKY MONKEY plese
please**
Aizaz Shahid
@aizazshahid
May 07 2017 03:43
@snoudin yess ??
snoudin
@snoudin
May 07 2017 03:45
@forwebtech yess
Aizaz Shahid
@aizazshahid
May 07 2017 03:46
@snoudin paste your code !
snoudin
@snoudin
May 07 2017 03:47
i haven`t any working code
arrays have bugs
on that challenge
Aizaz Shahid
@aizazshahid
May 07 2017 03:47
still need that.
HeebieGeeBee
@HeebieGeeBee
May 07 2017 03:47
@forwebtech you can just do this arr1 = [...new Set(args.shift())]; no need for all arr1 = Array.from( [...new Set(args.shift())] );
Aizaz Shahid
@aizazshahid
May 07 2017 03:47
if i can see then am able to correct it .
@HeebieGeeBee :) you always short my code, but overall ??
HeebieGeeBee
@HeebieGeeBee
May 07 2017 03:48
yes nice
just dont need to try and make the array twice
trying to make an array from something that is already an array
snoudin
@snoudin
May 07 2017 03:50
@forwebtech wait a minute
Aizaz Shahid
@aizazshahid
May 07 2017 03:50
@HeebieGeeBee thanks, for that, didn't realize that !
CamperBot
@camperbot
May 07 2017 03:50
:star2: 1586 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
forwebtech sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
May 07 2017 03:51
@forwebtech and i would kinda prefer to use an unshift for the unique
so it becomes the first array for the next time
but i guess it dont matter cus youre sorting the array anyway
think in the diff two arrays they wanted the order kept
but this one doesnt matter
Vamp
@the-vampiire
May 07 2017 03:53
@Giveback007 here are my regex notes for that problem
essentially you have 2 “types” of formats to play with:
( ) group - anything in this has to be matched exactly as seen in the group
[ ] range - a match can be found for any character within this “range” of characters. 
you can also put an actual dash separated range in here for digits, 0-9, or lower alpha, a-z, upper alpha, A-Z

and 2 types of quantifiers placed beside a char, or outside a group or range:
? - match 0 or 1 time, placed next to a character in /char?/ format or outside a group / range 
to specify for that group range (char)? [char-char]?
{} - match {x} times exactly, match {x, y} x to y times exactly, match {x, } x to infinite times

the OR pipe
| - used in groups to specify that either match within that group is acceptable. just like || for javascript you can have multiple of these in a group 

the ^ start and $ finish markers
^ - starts with, this character, group, range
$ - ends here (exactly match up to this point)

these terms may or may not reflect the technical terminology of regex. just something I wrote up for myself and a friend I was teaching

this is not an all encompassing lesson on regex just some useful parts that I used to solve the phone number problem

snoudin
@snoudin
May 07 2017 03:55

@forwebtech thats my code: `
function chunkArrayInGroups(arr, size) {
// Break it up.
var z =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var c =[];
z.map(function(val){
c.push(val * size);//should return [2,4,6,8...]
});
var j = size - 1;
var v = c-j;//must be [1,3,5,7...]
return arr.split('').slice(c,j);

}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
`

Aizaz Shahid
@aizazshahid
May 07 2017 03:55
well the task don't need .sort() @HeebieGeeBee , but your that tip didn't get ?
that use ... instead unique !
HeebieGeeBee
@HeebieGeeBee
May 07 2017 03:55
what do you mean?
Aizaz Shahid
@aizazshahid
May 07 2017 03:56
@forwebtech and i would kinda prefer to use an unshift for the unique
HeebieGeeBee
@HeebieGeeBee
May 07 2017 03:56
instead of pushing the array to the back of args you unshift to the the front
Aizaz Shahid
@aizazshahid
May 07 2017 03:57
but that makes any difference ?
@snoudin i don't get it why you create z array ?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 03:58
@forwebtech no it doesnt im just saying i woulda have shifted to the front
Aizaz Shahid
@aizazshahid
May 07 2017 03:59
@HeebieGeeBee ok !
snoudin
@snoudin
May 07 2017 03:59
@forwebtech i don`t know how to list all indexes
Aizaz Shahid
@aizazshahid
May 07 2017 04:00
@snoudin need to make a for loop.
Vamp
@the-vampiire
May 07 2017 04:01
for(var i = 0; i < arr.length; i++){
    console.log(arr[i]);
}
snoudin
@snoudin
May 07 2017 04:01
don`t work
Aizaz Shahid
@aizazshahid
May 07 2017 04:01
@snoudin as @the-vampiire created !
snoudin
@snoudin
May 07 2017 04:01
i`ve tried
Vamp
@the-vampiire
May 07 2017 04:01
lol
I can assure you this works
Aizaz Shahid
@aizazshahid
May 07 2017 04:01
hahha !
@snoudin did you know how to open browser console
snoudin
@snoudin
May 07 2017 04:02
i`ve COPIED and it returns last number
@forwebtech yes
Aizaz Shahid
@aizazshahid
May 07 2017 04:02
@snoudin then check their you have some outputs.
@snoudin your logic isn't correct, lots of problems to sort, that's why not working in FCC !
snoudin
@snoudin
May 07 2017 04:03
Uncaught TypeError: arr.split is not a function
at chunkArrayInGroups (chunky-monkey:12)
at chunky-monkey:16
commonFramework-120fa0af86.js:1 TypeError: arr.split is not a function
at chunkArrayInGroups (eval at evalJs (https://www.freecodecamp.com/challenges/chunky-monkey:1:681), <anonymous>:12:14)
at eval (eval at evalJs (https://www.freecodecamp.com/challenges/chunky-monkey:1:681), <anonymous>:16:1)
at Object.evalJs [as getJsOutput] (https://www.freecodecamp.com/challenges/chunky-monkey:1:250663)
at https://www.freecodecamp.com/js/commonFramework-120fa0af86.js:1:16712
From previous event:
at Object.runPreviewTests$ (https://www.freecodecamp.com/challenges/chunky-monkey:1:251037)
at https://www.freecodecamp.com/js/commonFramework-120fa0af86.js:1:16733
(anonymous) @ commonFramework-120fa0af86.js:1
Aizaz Shahid
@aizazshahid
May 07 2017 04:04
@snoudin close the console immediately, :laughing:
snoudin
@snoudin
May 07 2017 04:05
my english isn`t so good
i`m russian
Aizaz Shahid
@aizazshahid
May 07 2017 04:05
also same here :)
i am Pakistani !
native language isn't English.
snoudin
@snoudin
May 07 2017 04:06
i understood
Aizaz Shahid
@aizazshahid
May 07 2017 04:06
well just paste the current code, in formatting
snoudin
@snoudin
May 07 2017 04:06
@forwebtech I AM 13
Aizaz Shahid
@aizazshahid
May 07 2017 04:06

:bulb: To format your code, please follow:
Code Formatting

More details..

snoudin
@snoudin
May 07 2017 04:06
*years old
Gopi P
@GopiTheContributer
May 07 2017 04:06
I stucking with constructor function topic. can anyone help me.
Aizaz Shahid
@aizazshahid
May 07 2017 04:06
@snoudin did you know snowden ??
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:07
@forwebtech
function sym(args) {
  args = [...arguments];
    return args.reduce(function(a, b) {
    a = [...new Set(a)];
    b = [...new Set(b)];
    a = a.concat(b);
    return a.filter( (val) => a.indexOf(val) === a.lastIndexOf(val) );
  });
}
snoudin
@snoudin
May 07 2017 04:07
function chunkArrayInGroups(arr, size) {
3
  // Break it up.
4
  var z =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
5
  var c =[];
6
  z.map(function(val){
7
  c.push(val * size);//should return [2,4,6,8...]
8
});
9
  var j = size - 1;
10
  var v = c-j;//must be [1,3,5,7...]
11
  return arr.split('').slice(c,j);
12

13
}
1415
chunkArrayInGroups(["a", "b", "c", "d"], 2);
16
Aizaz Shahid
@aizazshahid
May 07 2017 04:08
@HeebieGeeBee well at first i think of the .reduce() but thought much complicated, so i moved on that solution, but seems i need to change my code :)
snoudin
@snoudin
May 07 2017 04:08
@forwebtech are you joking???
Aizaz Shahid
@aizazshahid
May 07 2017 04:08
@snoudin what ??
snoudin
@snoudin
May 07 2017 04:09
about sweden
Aizaz Shahid
@aizazshahid
May 07 2017 04:09
well he is there still ??
snoudin
@snoudin
May 07 2017 04:09
i`m 13 years old
Aizaz Shahid
@aizazshahid
May 07 2017 04:09
but what if wrong in asking a question.
you are 13 years old and doing programming, what do you want kid !
@snoudin well tell me what are the numbers in your code at every line ??
snoudin
@snoudin
May 07 2017 04:11
fffffffuuu.... I`ve read wrong
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:11
@forwebtech not sure we can get it any smaller, but maybe
snoudin
@snoudin
May 07 2017 04:11
i can`t think more today
kickkick479
@kickkick479
May 07 2017 04:11
@snoudin Hi.
split() is method for string. So you got error like Uncaught TypeError: arr.split is not a function
snoudin
@snoudin
May 07 2017 04:12
i`ve bugged myself
@kickkick479 thanks
CamperBot
@camperbot
May 07 2017 04:12
snoudin sends brownie points to @kickkick479 :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @kickkick479 |http://www.freecodecamp.com/kickkick479
kickkick479
@kickkick479
May 07 2017 04:13
@GopiTheContributer Can you share your code?
Aizaz Shahid
@aizazshahid
May 07 2017 04:14

@HeebieGeeBee well i had read this

if your feel your code is too complex to understand without comments, your code is probably just bad. Rewrite it until it doesn't need comments any more. If, at the end of that effort, you still feel comments are necessary, then by all means, add comments. Carefully

Ref: Coding without comments

also you should to read if not read already!
i think too much short is not good like in this code:
function sym(...args) { 
  /* first go over each subarray and remove all duplicate values,
  then reduce the concatenation of two arrays by only allowing 
  values that are in either of the two (XOR).*/

  return args.map(arr => 
      [...new Set(arr)])
        .reduce((a,b) => a.concat(b)
        .filter(v => !b.includes(v) || !a.includes(v)));
 }
ilyazbei
@ilyazbei
May 07 2017 04:16
hello wordl
Aizaz Shahid
@aizazshahid
May 07 2017 04:16
@HeebieGeeBee
kickkick479
@kickkick479
May 07 2017 04:16
@ilyazbei hi
Aizaz Shahid
@aizazshahid
May 07 2017 04:16
not my code just copy it from other source !
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:16
@forwebtechwht why not?
Aizaz Shahid
@aizazshahid
May 07 2017 04:16
@ilyazbei Welcome !
charlotteengland
@charlotteengland
May 07 2017 04:17
How do I paste my code formated?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:17
these are algorithm challenges not commercial code
kickkick479
@kickkick479
May 07 2017 04:17
@charlotteengland See more info below, '''
CamperBot
@camperbot
May 07 2017 04:17
:bulb: to format code use backticks! ``` more info
Aizaz Shahid
@aizazshahid
May 07 2017 04:18
@HeebieGeeBee but it also has part into your coding habbits !
ilyazbei
@ilyazbei
May 07 2017 04:18
is there a way of uploading a screen shot with my question to this chat?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:18
and that code is not hard to read
Aizaz Shahid
@aizazshahid
May 07 2017 04:19
@ilyazbei just copy the screen and paste here
@ilyazbei (windows) use snipping tool, to get the image
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:19
i comment in my projects not for the challenges
Kelechi Chinaka
@ke1echi
May 07 2017 04:20

function orderMyLogic(val) {
  if (val < 10) {
    return "Less than 10";
  } else if (val < 5) {
    return "Less than 5";
  } else {
    return "Greater than or equal to 10";
  }
}

// Change this value to test
orderMyLogic(4);
what are my doing wrong @HeebieGeeBee
ilyazbei
@ilyazbei
May 07 2017 04:20
iam working on algorithm from another book
Aizaz Shahid
@aizazshahid
May 07 2017 04:20

@HeebieGeeBee

and that code is not hard to read

well am know my knowledge is nothing,

ilyazbei
@ilyazbei
May 07 2017 04:20
and i have image
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:20
@kelechichinaka think about the order
Aizaz Shahid
@aizazshahid
May 07 2017 04:20
that's why it's hard for me !
ilyazbei
@ilyazbei
May 07 2017 04:20
there is no way to paste a image here
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:20
anything that is less than 10 is oging to be less than 5
Aizaz Shahid
@aizazshahid
May 07 2017 04:20
@ilyazbei you are on same network ??
means router ?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:20
i mean anything that is less than 5 is going to be less than 10
charlotteengland
@charlotteengland
May 07 2017 04:20
Hey could someone take a look at where my error is with JS conditional statements

// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) { 
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {
  if(true){
    return "Yes, that was true";
  }
  return "No that was false";

  // Only change code below this line.



  // Only change code above this line.

}

// Change this value to test
trueOrFalse(true);
ilyazbei
@ilyazbei
May 07 2017 04:21
@forwebtech ?
Aizaz Shahid
@aizazshahid
May 07 2017 04:21
@ilyazbei from which device you need image ?
ilyazbei
@ilyazbei
May 07 2017 04:21
mac
desctop
Kelechi Chinaka
@ke1echi
May 07 2017 04:22
ok @HeebieGeeBee
Aizaz Shahid
@aizazshahid
May 07 2017 04:22
so two devices ?? correct
@ilyazbei and you want to copy it from mac to desktop ?
kickkick479
@kickkick479
May 07 2017 04:22
@kelechichinaka if-else is exclusive. So as Heebie said, the order your code is important.
charlotteengland
@charlotteengland
May 07 2017 04:22
Sorry, I meant:

// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) { 
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {
  if(true){
    return "Yes, that was true";
  }
  return "No, that was false";

  // Only change code below this line.



  // Only change code above this line.

}

// Change this value to test
trueOrFalse(true);
ilyazbei
@ilyazbei
May 07 2017 04:22
i have iMac and macbook
Aizaz Shahid
@aizazshahid
May 07 2017 04:22
@ilyazbei well whatever !
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:22
@charlotteengland look at your if condition
Aizaz Shahid
@aizazshahid
May 07 2017 04:22
and am asking you are using one internet connection on both devices ?
ilyazbei
@ilyazbei
May 07 2017 04:22
ok how do i upload a picture here
yes
Aizaz Shahid
@aizazshahid
May 07 2017 04:23
if you copy have copied, then just paste here !
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:23
@charlotteengland true is always going to be true, but you should be testing if your parameter is true
ilyazbei
@ilyazbei
May 07 2017 04:23
ans1.jpeg
Aizaz Shahid
@aizazshahid
May 07 2017 04:23
and to get the image from other device you just need to share it !
@ilyazbei copy the image not name :)
ilyazbei
@ilyazbei
May 07 2017 04:23
i want to upload a picture to this chat
charlotteengland
@charlotteengland
May 07 2017 04:23
@HeebieGeeBee yes, the true bit is testing correctly, but the false section is not retuning the expected "No, that was false"
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:24
@charlotteengland that becuase your condition is aksing if true is true, which it will always be , so thats what return youre going to get
look at their example above, what are they testing in their if condition?
Aizaz Shahid
@aizazshahid
May 07 2017 04:24
then it will automatically shown !
ilyazbei
@ilyazbei
May 07 2017 04:25
Aziz i am copying image
but chat wont take the image
Aizaz Shahid
@aizazshahid
May 07 2017 04:25
@ilyazbei yes buddy you can also upload here by just pasting it here !
ilyazbei
@ilyazbei
May 07 2017 04:25
have anyone was able to upload any jpeg format file here
HN
@haydennorthcott
May 07 2017 04:25
where do I start with Generate Random Fractions with JavaScript??
ilyazbei
@ilyazbei
May 07 2017 04:25
iam doing that it is not workign
Aizaz Shahid
@aizazshahid
May 07 2017 04:26
@ilyazbei listen where is your picture ?
locally ?
charlotteengland
@charlotteengland
May 07 2017 04:26
@HeebieGeeBee ah gotchaa #feelingsilly
many thanks
CamperBot
@camperbot
May 07 2017 04:26
charlotteengland sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1587 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
ilyazbei
@ilyazbei
May 07 2017 04:26
desctop
Aizaz Shahid
@aizazshahid
May 07 2017 04:26
network-web-generic-02.png
so drag that picture to the browser and then right click and copy image and then paste it here !
like i did it just above !
ilyazbei
@ilyazbei
May 07 2017 04:27
it wont paste
Aizaz Shahid
@aizazshahid
May 07 2017 04:28
actually you are not copying it properly wait
am pasting an sample image which shows you how to copy !
kickkick479
@kickkick479
May 07 2017 04:28
2x2.jpg
ilyazbei
@ilyazbei
May 07 2017 04:28
ok thanks
Aizaz Shahid
@aizazshahid
May 07 2017 04:29
that image is opened in the tab in firefox !
kickkick479
@kickkick479
May 07 2017 04:29
@ilyazbei I tested gitter right now. If you drag your image and drop it to this gitter window, you can upload.
Aizaz Shahid
@aizazshahid
May 07 2017 04:29
image.png
nsonhouse
@nsonhouse
May 07 2017 04:30
Hello all
kickkick479
@kickkick479
May 07 2017 04:30
@nsonhouse hi
Aizaz Shahid
@aizazshahid
May 07 2017 04:30
@ilyazbei and @kickkick479 method is efficient.
@nsonhouse Welcome !
nsonhouse
@nsonhouse
May 07 2017 04:31
Can any one assist me with how to pass a function parameter into a connection.query('SELECT ... statement?
ilyazbei
@ilyazbei
May 07 2017 04:31
iam doing that and it is not pasting anything
iam using google chrome
what browser are you on Aziz
Aizaz Shahid
@aizazshahid
May 07 2017 04:32
@ilyazbei well drag the image here just, as @kickkick479 suggested !
kickkick479
@kickkick479
May 07 2017 04:33
2x2.jpg
@ilyazbei I tested both app for mac and chrome. Either works! Last one is excecuted on chrome.
ilyazbei
@ilyazbei
May 07 2017 04:33
iam draging it from my desctop here and it leaves this site and shows my picture on my browser
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:34
@ilyazbei are you dragging it into where you type the chat?
Viknesh
@vk2mars
May 07 2017 04:34
Would someone mind helping me identify my infinite loop? I stepped through it on Chrome DevTools and it outputs properly but then it gets stuck on some bundle.js core Chrome component. The infinite loop problem started when I added the if (billsToCurr > cid[index][1]){ billsToCurr = cid[index][1]; numBill = billsToCurr/bigBill; }
function checkCashRegister(price, cash, cid) {
  var needed = cash - price;
  var available = cid.reduce(
    function(a,v){
      return a + v[1];
    },0);

   available = Math.ceil(available*100)/100;

  if(available < needed ) return "Insufficient Funds";

  if(needed == available) return "Closed";
  // Here is your change, ma'am.
  var currencyValues = [0.01,0.05,0.10,0.25,1.00,5.00,10.00,20.00,100.00];

  function biggestBill(needed,cid){
    //Find possible bills that fit the bill
    var goodBills = currencyValues.filter(function(val){return val<=needed;});
    // Whats the best bill?
    function bigly(a,b){return Math.max(a, b);}

    var highestBill = goodBills.reduce(bigly);
    //Check and adjust for presence in cid

    while(cid[currencyValues.indexOf(highestBill)][1] === 0){

      if(highestBill === 0.01){
        return 0.01;
      }
      goodBills.pop();
        highestBill = goodBills.reduce(bigly);

      }

    return highestBill;
  }


  var change = [];
  while(needed > 0){
    //Find the largest possible bill
    var bigBill = biggestBill(needed,cid);
    var numBill = Math.floor(needed/bigBill);
    var billsToCurr = bigBill*numBill;
    var index = currencyValues.indexOf(bigBill);

    if (billsToCurr > cid[index][1]){
      billsToCurr = cid[index][1];
      numBill = billsToCurr/bigBill;
    }


    //Use it
    needed = needed - billsToCurr;
    needed = Math.ceil(needed*100)/100;

    //Account for the subraction

    cid[index][1] = cid[index][1] - billsToCurr;

    //Add to output
    change.push([cid[index][0],billsToCurr]);

  }

  return change;
}
ilyazbei
@ilyazbei
May 07 2017 04:34
yes
Aizaz Shahid
@aizazshahid
May 07 2017 04:34
bg2.jpg
@ilyazbei well dragging is working fine if you just drag into that chat area !
Steven
@LemonTruth
May 07 2017 04:36
function palindrome(str) {
 var array = [];
  array = str.split("");
  var arrayReverse = array.reverse();
  for (i = array.length; i--;){
    if (array[i] !== arrayReverse[i]){
      return false;
    }
    return true;
  }

}
I need help with the palindrome algorithm scripting
nsonhouse
@nsonhouse
May 07 2017 04:37
any mysql pros here?
Aizaz Shahid
@aizazshahid
May 07 2017 04:38
@LemonTruth you need to remove the non-alphabatic characters and spaces also first !
@nsonhouse yes ?
nsonhouse
@nsonhouse
May 07 2017 04:38
I need to pass the parameters from a function into a select statement.
Steven
@LemonTruth
May 07 2017 04:39
@forwebtech I know, I was considering doing that after, but for now, are you able to see why something like palindrome(nope) would return true?
Aizaz Shahid
@aizazshahid
May 07 2017 04:39
@nsonhouse parameters are the column names ??
kickkick479
@kickkick479
May 07 2017 04:39

@nsonhouse u r talking node.js or something ? Im not familiar with those. But you can put function with fuction name or annonymous function. like this

connection.query(queryString, function(err, rows, fields) {
    if (err) throw err;

    for (var i in rows) {
        console.log('Post Titles: ', rows[i].post_title);
    }
});

That is an example of annonymous fuction. Quoted from http://www.codediesel.com/nodejs/querying-mysql-with-node-js/

Aizaz Shahid
@aizazshahid
May 07 2017 04:39
@nsonhouse paste the sql query, as you wants i will modify it :)
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:39
@LemonTruth your loop is only testing the first letter
nsonhouse
@nsonhouse
May 07 2017 04:39
@kickkick479 function checkInventory( itemid, qty){
connection.query('SELECT * FROM products WHERE item_id = itemid', function(err, res){
console.log(res);
});
}
The parameters are passed from th inquirer function
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:40
@LemonTruth a return stops the function so if it hits a return on the first iteration thats the only one its going to do
Aizaz Shahid
@aizazshahid
May 07 2017 04:40
'SELECT * FROM products WHERE item_id = ' +  itemid
you just need that
nsonhouse
@nsonhouse
May 07 2017 04:41
When I console.log(res) I get the entire output of the table
Aizaz Shahid
@aizazshahid
May 07 2017 04:41
actually when you put the variable into quotes it will become just letters /string !
Steven
@LemonTruth
May 07 2017 04:41
@HeebieGeeBee i know, but if even 1 letter doesn't match then it isnt a palindrome right?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:42
@LemonTruth also your loop has no codition so surprised it hasnt crashed your browser
condition
Aizaz Shahid
@aizazshahid
May 07 2017 04:42
@nsonhouse now check with modified query ?
:point_up: May 7, 2017 9:40 AM
Steven
@LemonTruth
May 07 2017 04:42
@HeebieGeeBee no condition?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:43
for (i = array.length; i--;)
Viknesh
@vk2mars
May 07 2017 04:43
If anyone could take a look at my code above, that'd be great
Masaki
@masaki1223
May 07 2017 04:43
Hello everyone. How can I make .indexOf into noncase-sensitive and doesn't care the order of characters? I'm stuck
nsonhouse
@nsonhouse
May 07 2017 04:43
@forwebtech It worked. Please explain.
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:44
this is not a good for loop
Joseph
@revisualize
May 07 2017 04:44
@nsonhouse Before you pass anything to SQL you need to sanitize the input.
Aizaz Shahid
@aizazshahid
May 07 2017 04:44
@nsonhouse well because your itemid is a argument right ?
nsonhouse
@nsonhouse
May 07 2017 04:44
yes
Steven
@LemonTruth
May 07 2017 04:44
@HeebieGeeBee
Adel
@AdelMahjoub
May 07 2017 04:45
@nsonhouse
function checkInventory( itemid, qty){
  var sql = `SELECT * FROM products WHERE item_id=${connection.escape(itemid)}`
  connection.query(sql, function(err, res){
    console.log(res);
  });
}
Aizaz Shahid
@aizazshahid
May 07 2017 04:45
@nsonhouse so if you put that name into quotes, variable name, it will becomes just a string !
Steven
@LemonTruth
May 07 2017 04:45
@HeebieGeeBee ```
nsonhouse
@nsonhouse
May 07 2017 04:45
OOOOO
gotcha
Steven
@LemonTruth
May 07 2017 04:45
function palindrome(str) {
 var array = [];
  array = str.split("");
  var arrayReverse = array.reverse();
  for (i = 0; array < array.length; i++){
    if (array[i] !== arrayReverse[i]){
      return false;
    }
    return true;
  }
}
Aizaz Shahid
@aizazshahid
May 07 2017 04:45
so your query is get there as item_id = itemid not getting the value !
Joseph
@revisualize
May 07 2017 04:45
@AdelMahjoub what does connection.escape() do?
Steven
@LemonTruth
May 07 2017 04:45
@HeebieGeeBee is that better?
nsonhouse
@nsonhouse
May 07 2017 04:45
@forwebtech Thank you very much
CamperBot
@camperbot
May 07 2017 04:45
nsonhouse sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 440 | @forwebtech |http://www.freecodecamp.com/forwebtech
Joseph
@revisualize
May 07 2017 04:46
@LemonTruth You need to remove all non-alphanumeric characters from the string.
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:46
i < array.length @LemonTruth
Aizaz Shahid
@aizazshahid
May 07 2017 04:46
@nsonhouse :+1:
Adel
@AdelMahjoub
May 07 2017 04:46
@revisualize avoid sql injection
Joseph
@revisualize
May 07 2017 04:46
@LemonTruth Your for loop won't loop.
@AdelMahjoub Where can I find that?
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:46
@revisualize apperently he knows all that
Steven
@LemonTruth
May 07 2017 04:47
function palindrome(str) {
 var array = [];
  array = str.split("");
  var arrayReverse = array.reverse();
  for (i = 0; i < array.length; i++){
    if (array[i] !== arrayReverse[i]){
      return false;
    }
    return true;
  }
}
hmmm, this won't work either
Aizaz Shahid
@aizazshahid
May 07 2017 04:47
@AdelMahjoub you are passing variable to the string ?? :point_up: May 7, 2017 9:45 AM
Adel
@AdelMahjoub
May 07 2017 04:47
@forwebtech string literals
Joseph
@revisualize
May 07 2017 04:47
@LemonTruth Look. You have to be very careful when you trigger a return statement.
A return statement HALTs the whole function and returns that value back to the function caller.
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:48
@LemonTruth you realise reverse method mutates the array its called upon
so youre comparing the same arrays
Joseph
@revisualize
May 07 2017 04:48
@LemonTruth With the code that you have once return true is triggered the loop HALTs
HeebieGeeBee
@HeebieGeeBee
May 07 2017 04:48
in the same order
Aizaz Shahid
@aizazshahid
May 07 2017 04:48
@AdelMahjoub
var sql = `SELECT * FROM products WHERE item_id=${connection.escape(itemid)}`
does it work ??
Adel
@AdelMahjoub
May 07 2017 04:49
@forwebtech yes it is a string literal
Aizaz Shahid
@aizazshahid
May 07 2017 04:49
itemid variable into that string ??
Aizaz Shahid
@aizazshahid
May 07 2017 04:51
@AdelMahjoub i think that is ${ .. } sql syntax ??
Aizaz Shahid
@aizazshahid
May 07 2017 04:52
@AdelMahjoub any example of sql injection ??
that, why using just argument name can cause sql injection ?
Adel
@AdelMahjoub
May 07 2017 04:54
@forwebtech idk, just following the docs https://github.com/mysqljs/mysql#escaping-query-values
Aizaz Shahid
@aizazshahid
May 07 2017 04:55
what is idk ??
kickkick479
@kickkick479
May 07 2017 04:55
@forwebtech I Don't Know, right?
Joseph
@revisualize
May 07 2017 04:55
@forwebtech You need to be careful that someone doesn't pass a value a item_id to terminate the statement then pass their own SQL argument.
Aizaz Shahid
@aizazshahid
May 07 2017 04:56
@revisualize but how someone can do that as it is doing on server side ??
suppose we are using server-side language to handle it !
Joseph
@revisualize
May 07 2017 04:56
@forwebtech Just be safe.
@forwebtech Always sanitize your values.
Sandra Smith
@sandrarmsmith
May 07 2017 04:56
Hello, I have a form that when they push the submit button, it gives them a confirmation page that sends their info to the email address. How can I do this?
Aizaz Shahid
@aizazshahid
May 07 2017 04:56
why ??
Joseph
@revisualize
May 07 2017 04:57
@forwebtech Do you want to get hacked?
Aizaz Shahid
@aizazshahid
May 07 2017 04:57
@revisualize not arguing just need to understand !
Joseph
@revisualize
May 07 2017 04:57
@forwebtech What happens if for some reason the value gets passed to terminate your select statement the someone passes Delete table users
Aizaz Shahid
@aizazshahid
May 07 2017 04:57
@AdelMahjoub now you stopped me otherwise have lots of questions :)
@revisualize again how it can do that ??
Adel
@AdelMahjoub
May 07 2017 04:58
@forwebtech most of the data is provided by the user,
Aizaz Shahid
@aizazshahid
May 07 2017 04:58
unless he didn't get into server !
Joseph
@revisualize
May 07 2017 04:58
@AdelMahjoub Or worse your SQL runs as an admin and then the person creates a new a new user as ADMIN.
Aizaz Shahid
@aizazshahid
May 07 2017 04:58
@AdelMahjoub @revisualize that means we have to careful, when dealing with client side data ??
Joseph
@revisualize
May 07 2017 04:58
@forwebtech I don't know your code base. I don't know where it comes from.
Kelechi Chinaka
@ke1echi
May 07 2017 04:58
the more i am exposed to js the clearer it becomes
Joseph
@revisualize
May 07 2017 04:59
@forwebtech Okay man. Do you .. Don't sanitize your data.
Khoa Le
@Zacele
May 07 2017 04:59
gosh
the "Exact change" challenge is so hard
Aizaz Shahid
@aizazshahid
May 07 2017 04:59
@revisualize that's not the correct answer don't do that, you have to give valid reason also !
Aizaz Shahid
@aizazshahid
May 07 2017 05:00
:) if you don't know then you should probably tell me at first :)
Joseph
@revisualize
May 07 2017 05:01
@forwebtech I do know. I've exploited a few sites via SQL injection.
@forwebtech Again, I don't know your code base.
Aizaz Shahid
@aizazshahid
May 07 2017 05:01
@revisualize can you talk me in private ?
Joseph
@revisualize
May 07 2017 05:01
@forwebtech I don't know exactly where your data comes from.
Aizaz Shahid
@aizazshahid
May 07 2017 05:01
@revisualize in this chat most of the people don't know about that so its better to talk privately !
Joseph
@revisualize
May 07 2017 05:02
@forwebtech If I don't know where your variables come from, How can I give you clear information? ... I've been told by security experts to ALWAYS sanitize your variables that get passed into any SQL statements.
@forwebtech I don't do PMs.
Aizaz Shahid
@aizazshahid
May 07 2017 05:03
@revisualize sure sir !
@revisualize looks like you have lots of experience ! but its ok !
still thanks for the info @revisualize @AdelMahjoub
CamperBot
@camperbot
May 07 2017 05:03
forwebtech sends brownie points to @revisualize and @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 447 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
:star2: 3903 | @revisualize |http://www.freecodecamp.com/revisualize
Aizaz Shahid
@aizazshahid
May 07 2017 05:05
@sandrarmsmith ?
Hello, I have a form that when they push the submit button, it gives them a confirmation page that sends their info to the email address. How can I do this?
Joseph
@revisualize
May 07 2017 05:06
@forwebtech I'm not trying to be an ass. It's easy to sanitize your data. I don't understand why someone wouldn't do it when they are presented with information about a potential flaw in their code.
Aniculaesei
@Aniculaesei
May 07 2017 05:06
Hello guys!Can you help me at "Seek and Destroy" algorithm problem please?
I don't know how to use the arguments that are introduced
Aizaz Shahid
@aizazshahid
May 07 2017 05:07
@Aniculaesei sure !
@revisualize well, seems the talk will go longer so its better to stop here.
@Aniculaesei did you know we have arguments object predefined to every function?
try to console.log() it.
Aniculaesei
@Aniculaesei
May 07 2017 05:08
hmm..this I dont understand....:D
arguments object predefined to every function
Aizaz Shahid
@aizazshahid
May 07 2017 05:09
@Aniculaesei yes as am saying do that console.log(arguments)
into your function !
Joseph
@revisualize
May 07 2017 05:11
@Aniculaesei Yes.
Aniculaesei
@Aniculaesei
May 07 2017 05:11
I have done....from this: destroyer([1, 2, 3, 1, 2, 3], 2, 3);
It give me destroyer[1, 2, 3, 1, 2, 3]
Aizaz Shahid
@aizazshahid
May 07 2017 05:12
@Aniculaesei you can get arguments by this method Array.from(arguments)
Joseph
@revisualize
May 07 2017 05:12
function someArguments (name) {
     console.log(name);
     console.log(arguments);
     return "Hello " + name;
}
someArguments("Happy", "Feet", "has", "rhythm", "soul", "groove", "and", "when", "he", "starts", "to", "tap", "his", "feet.", "He", "really", "shakes", "his", "tail", "feather");
Aizaz Shahid
@aizazshahid
May 07 2017 05:13
@Aniculaesei
function foo() {
    console.log(JSON.stringify(arguments));
}

foo("abcd", [1,2,3]);  // { "0":"abcd","1":[1,2,3] }
Sandra Smith
@sandrarmsmith
May 07 2017 05:15
@forwebtech I'm trying to figure out how to do it
Aniculaesei
@Aniculaesei
May 07 2017 05:16
@forwebtech Thanks!!
CamperBot
@camperbot
May 07 2017 05:16
aniculaesei sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 441 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
May 07 2017 05:16
@sandrarmsmith needs to send an email ??
@Aniculaesei also @revisualize deserves thanks because he made a good example !
CamperBot
@camperbot
May 07 2017 05:16
forwebtech sends brownie points to @aniculaesei and @revisualize :sparkles: :thumbsup: :sparkles:
:cookie: 254 | @aniculaesei |http://www.freecodecamp.com/aniculaesei
:warning: forwebtech already gave revisualize points
Joseph
@revisualize
May 07 2017 05:17
@sandrarmsmith You need to learn some back end coding. If you want to create a contact form.
Sandra Smith
@sandrarmsmith
May 07 2017 05:17
@forwebtech after the user inputs the information and presses submit, I want to send the information to an email address
I've been trying to figure it out all day. My project is due tomorrow
Aizaz Shahid
@aizazshahid
May 07 2017 05:18
@sandrarmsmith in order to do that you need to learn a server side language like PHP.
Joseph
@revisualize
May 07 2017 05:18
@sandrarmsmith Do you have access to a server that can run back end code?
Aniculaesei
@Aniculaesei
May 07 2017 05:18
@forwebtech :)
Sandra Smith
@sandrarmsmith
May 07 2017 05:18
I'm running my site through cpanel
Aizaz Shahid
@aizazshahid
May 07 2017 05:19
do you know PHP or other languages ?
Sandra Smith
@sandrarmsmith
May 07 2017 05:19
i know some php..i'm a beginner
Aizaz Shahid
@aizazshahid
May 07 2017 05:20
well then take some lessons at PHP Tutorial
or that one, specific for mailing purpose PHP mail
@sandrarmsmith do you need to know? how to send exactly using PHP ?