These are chat archives for FreeCodeCamp/HelpJavaScript

5th
Jul 2017
Joseph
@revisualize
Jul 05 2017 00:01
Hi
Ming Zhu
@chocobrownie
Jul 05 2017 00:03
Hi ppl, How do you make a two-decimal NUMBER (not string) in JavaScript? I am working on front end-advanced algorithm-"exact change" challenge and it forces me to output the two-decimal number
Like making 0.5 to 0.50
Joseph
@revisualize
Jul 05 2017 00:03
@chocobrownie Just like that
Oh
Ming Zhu
@chocobrownie
Jul 05 2017 00:04
Huh?
@revisualize
Ming Zhu
@chocobrownie
Jul 05 2017 00:06
@revisualize It returns a string
I need a number type
Jor
@joreyesl
Jul 05 2017 00:07
@chocobrownie did you pass the rest of the tests?
Ming Zhu
@chocobrownie
Jul 05 2017 00:08
@joreyesl I did not pass any test that require number out put cuz they need two decimal but I did pass other tests
Joseph
@revisualize
Jul 05 2017 00:09
@chocobrownie Sorry I don't know.
Jor
@joreyesl
Jul 05 2017 00:09
@chocobrownie I remember other people having the same problem that you describe, but it usually only on that one case
Simon Hoyos
@shmesa22
Jul 05 2017 00:09
@chocobrownie try parseFloat(youString).toFixed(2)
parseFloat convert the string into a float number
And the method toFixed(2) adds to decimal places
Ming Zhu
@chocobrownie
Jul 05 2017 00:10
@shmesa22 I tried it, parseFloat converts that 0.50 to 0.5 again
onejo578
@onejo578
Jul 05 2017 00:11
@sjames1958gm @joreyesl Thanks for earlier, btw :) only just nailed it haha
CamperBot
@camperbot
Jul 05 2017 00:11
onejo578 sends brownie points to @sjames1958gm and @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 824 | @joreyesl |http://www.freecodecamp.com/joreyesl
:star2: 7988 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ming Zhu
@chocobrownie
Jul 05 2017 00:11
@revisualize It's alright man, thanks
CamperBot
@camperbot
Jul 05 2017 00:11
chocobrownie sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4304 | @revisualize |http://www.freecodecamp.com/revisualize
Ming Zhu
@chocobrownie
Jul 05 2017 00:11
@joreyesl That's weird, both test 4 and 5 requires 2 decimals
Jor
@joreyesl
Jul 05 2017 00:12
@chocobrownie you should be fine returning 0.5. I just checked my tests and I'm returning 0.5 not 0.50
Ming Zhu
@chocobrownie
Jul 05 2017 00:12
@shmesa22 In other words no matter what I do ParseFloat unpack it to least necessary decimal
@joreyesl So you returned 0.5 and you passed the test?
Jor
@joreyesl
Jul 05 2017 00:13
@chocobrownie yes, iirc the bug has to do with the ordering
do you have code we can look at?
Ming Zhu
@chocobrownie
Jul 05 2017 00:15
@joreyesl Let me check
function checkCashRegister(price, cash, cid) {
  var change;
  var cashBack = [[],[],[],[],[],[],[],[],[]];
  for (i=0;i<9;i++){
    for (j=0;j<2;j++){
      cashBack[i][j]=cid[i][j];
    }
  }
  console.log("initial cashBack="+ cashBack);
  var sum = 0;
  for (i = 0 ; i < cid.length ; i++){
    sum = Math.round((sum + cid[i][1]) * 100)/100;
  }
  if(cash - price === sum){
    return 'Closed';
  }
  console.log(cash-price);
  console.log(sum);
  console.log("sum=",(cash - price) > sum);
  if((cash - price) > sum){
    return 'Insufficient Funds';
  }

  var cashValue = [0.01,0.05,0.1,0.25,1,5,10,20,100],
    change = cash - price,
    cashIndex = 8;

  while(change > 0){
    console.log(cashIndex);
    console.log(change);
    if(change < cashValue[cashIndex]){
      cashIndex--;
      continue;
    }
    if (cid[cashIndex][1] > 0){
      change = Math.round(100*(change - cashValue[cashIndex]))/100;
      cid[cashIndex][1] = cid[cashIndex][1] - cashValue[cashIndex];
    }
    else {
      cashIndex--;
      continue;
    }

  }
  console.log("cid="+cid);
  console.log("cashBack="+cashBack);
  for(var i=8; i>=0; i--){
    cashBack[i][1] =  (Math.round(100*(cashBack[i][1] - cid[i][1]))/100);
    if (cashBack[i][1] == 0){
      cashBack.splice(i,1);
      cid.splice(i,1);
    }
  }

  console.log("finalResult = ",cashBack.reverse());
  // Here is your change, ma'am.
  return cashBack.reverse();
}


checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1.00], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]);
It actually fails to return "insufficient fund" in this case, you can see my console.log
Jor
@joreyesl
Jul 05 2017 00:17
@chocobrownie yea I ran your code, it passed all the tests except for that one
Stephen James
@sjames1958gm
Jul 05 2017 00:18
@chocobrownie because the drawer can have enough money valuewise but still not make change
Ming Zhu
@chocobrownie
Jul 05 2017 00:18
blob
@sjames1958gm Ic, I'll fix that
@joreyesl It doesn't run on mine
Jor
@joreyesl
Jul 05 2017 00:18
@chocobrownie try refreshing, those test passed for me
the only one that is failing is the insufficent funds one and its for the reason @sjames1958gm mentioned
Ming Zhu
@chocobrownie
Jul 05 2017 00:21
blob
@joreyesl It solved one problem by refreshing
Jor
@joreyesl
Jul 05 2017 00:22
@chocobrownie oh yea the ordering is important. you dont need the reverse()
Ming Zhu
@chocobrownie
Jul 05 2017 00:23
@joreyesl I added reverse() to fit the ordering
It does return the right ordering after I do that
Jor
@joreyesl
Jul 05 2017 00:23
@chocobrownie try removing it
Ming Zhu
@chocobrownie
Jul 05 2017 00:25
@joreyesl I just refreshed and tried it, it does not work
I previewed the result on Atom first btw, it looks like it needs reverse()
function checkCashRegister(price, cash, cid) {
  var change;
  var cashBack = [[],[],[],[],[],[],[],[],[]];
  for (i=0;i<9;i++){
    for (j=0;j<2;j++){
      cashBack[i][j]=cid[i][j];
    }
  }
  console.log("initial cashBack="+ cashBack);
  var sum = 0;
  for (i = 0 ; i < cid.length ; i++){
    sum = Math.round((sum + cid[i][1]) * 100)/100;
  }
  if(cash - price === sum){
    return 'Closed';
  }
  console.log(cash-price);
  console.log(sum);
  console.log("sum=",(cash - price) > sum);
  if((cash - price) > sum){
    return 'Insufficient Funds';
  }

  var cashValue = [0.01,0.05,0.1,0.25,1,5,10,20,100],
    change = cash - price,
    cashIndex = 8;

  while(change > 0){
    console.log(cashIndex);
    console.log(change);
    if(change < cashValue[cashIndex]){
      cashIndex--;
      continue;
    }
    if (cid[cashIndex][1] > 0){
      change = Math.round(100*(change - cashValue[cashIndex]))/100;
      cid[cashIndex][1] = cid[cashIndex][1] - cashValue[cashIndex];
    }
    else {
      cashIndex--;
      continue;
    }

  }
  console.log("cid="+cid);
  console.log("cashBack="+cashBack);
  for(var i=8; i>=0; i--){
    cashBack[i][1] =  (Math.round(100*(cashBack[i][1] - cid[i][1]))/100);
    if (cashBack[i][1] == 0){
      cashBack.splice(i,1);
      cid.splice(i,1);
    }
  }

  console.log("finalResult = ",cashBack);
  // Here is your change, ma'am.
  return cashBack;
}


checkCashRegister(3.26, 100.00, [["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]]);
This is the code I tried after removing it
My result looksthe same as the testwhen I have the reverse on
Not sure why
Jor
@joreyesl
Jul 05 2017 00:28
yea there is something different in that code than the one you posted earlier
Ming Zhu
@chocobrownie
Jul 05 2017 00:29
I removed .reverse()
I think that's it
Jor
@joreyesl
Jul 05 2017 00:29
something else cause I run the earlier and it passes, I run this one and is fails
Ming Zhu
@chocobrownie
Jul 05 2017 00:31
I just copied and pasted the same code I posted earlier, it fails two tests
Uh never mind that code comes with error when I refresh the page
Jor
@joreyesl
Jul 05 2017 00:32
@chocobrownie oh you have the .reverse() in the log...
Ming Zhu
@chocobrownie
Jul 05 2017 00:32
In the earlier post right? I removed reverse in the newer post
Jor
@joreyesl
Jul 05 2017 00:33
@chocobrownie yea you had a reverse() in the log and in the return
Steven Nyeo
@limpingstone
Jul 05 2017 00:33
How do you use regExp to express the four basic arithmetic symbols +-*/ ? This? : /+-\*\//
Ming Zhu
@chocobrownie
Jul 05 2017 00:33
Yea so I do need the reverse
Jor
@joreyesl
Jul 05 2017 00:33
yea just 1 tho, not in both places
Ming Zhu
@chocobrownie
Jul 05 2017 00:34
@joreyesl Let me try]
Oh ic, reverse() make modifications to the original array
So using it twice will change it back
Jor
@joreyesl
Jul 05 2017 00:35
@chocobrownie yes thats what was happening
Ming Zhu
@chocobrownie
Jul 05 2017 00:36
Uh....That helps a lot, I thought my error was at not having two decimals
I was struggling on that for a while already
Thanks man @joreyesl
CamperBot
@camperbot
Jul 05 2017 00:37
chocobrownie sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 825 | @joreyesl |http://www.freecodecamp.com/joreyesl
Jor
@joreyesl
Jul 05 2017 00:37
@chocobrownie np :thumbsup:
Ming Zhu
@chocobrownie
Jul 05 2017 00:38
@limpingstone I believe they are + - * test your regex on http://www.regexpal.com/
oh texting problem with the system
it's "+" "-"
...
\+ 
\-
\*
here
Steven Nyeo
@limpingstone
Jul 05 2017 00:42
\+\-\*\/ This
Ming Zhu
@chocobrownie
Jul 05 2017 00:45
yes
how do you input it this way lol @limpingstone
\
\
John
@AnonymousLords
Jul 05 2017 01:11
guys why doesnt this code work?

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "J"; // Fix Me
onejo578
@onejo578
Jul 05 2017 01:14
should just be myStr = "Hello World";
Steven Nyeo
@limpingstone
Jul 05 2017 01:14
@chocobrownie Ahh you need the []
kumquatfelafel
@kumquatfelafel
Jul 05 2017 01:15
^ Once created, strings can't be changed. @John-freeCodeCamp
In saying myStr[0] = "J", you're essentially saying, change this character in the string to "J". Which you can't do.
Gurpreet SIngh
@Gurpreet3131
Jul 05 2017 01:15
@John-freeCodeCamp it should be
Stephen James
@sjames1958gm
Jul 05 2017 01:15
@John-freeCodeCamp because strings are immutable, you cannot change an individual letter, so you have to set the whole new string
Gurpreet SIngh
@Gurpreet3131
Jul 05 2017 01:15
// Setup
var myStr = "Jello World";

// Only change code below this line

myStr = "Hello World"; // Fix Me
Steven Nyeo
@limpingstone
Jul 05 2017 01:15
@chocobrownie /[\+\-\*\/]/
Ming Zhu
@chocobrownie
Jul 05 2017 01:18
Ok thanks @limpingstone
CamperBot
@camperbot
Jul 05 2017 01:18
chocobrownie sends brownie points to @limpingstone :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @limpingstone |http://www.freecodecamp.com/limpingstone
John
@AnonymousLords
Jul 05 2017 01:23
lap tops almost out of battery, ill check the repliues later, thanks in advance
Nana Owusu
@nanaowusunyamekye
Jul 05 2017 01:36
hey y'all
Please how do i check if an object contains a property argument passed to it.
Like so
function someCode (object, property) {

}
Stephen James
@sjames1958gm
Jul 05 2017 01:43
@nanaowusunyamekye object.hasOwnProperty(property)
Manish Giri
@Manish-Giri
Jul 05 2017 01:43
@nanaowusunyamekye .hasOwnProperty()
Nana Owusu
@nanaowusunyamekye
Jul 05 2017 01:47
@Manish-Giri yeah, i've tried that but the test for the code is not passing
@sjames1958gm yeah, i've tried that but the test for the code is not passing
Manish Giri
@Manish-Giri
Jul 05 2017 01:50
take a look
Nana Owusu
@nanaowusunyamekye
Jul 05 2017 02:03

@Manish-Giri This is what I have now but its still not working. I will include the test written to check my answer below to give a little more context

function hasProperty(object, property) {
  //return true if the object has the value of the property argument
  //property is a string
  //otherwise return false

  if(object.hasOwnProperty('property')) {
    return true;
  }

  else {
    return false;
  }
}

This is the test

describe('hasProperty(object, property)', function() {
  it('should return true if the object has the property that is passed in', function() {
    var obj = {
      x: true
    };
    expect(exercises.hasProperty(obj, 'x')).toEqual(true);
    expect(exercises.hasProperty(obj, 'y')).toEqual(false);
  });
});
Manish Giri
@Manish-Giri
Jul 05 2017 02:05
why is property in quotes?
if(object.hasOwnProperty('property')) {
@nanaowusunyamekye
Nana Owusu
@nanaowusunyamekye
Jul 05 2017 02:06
@Manish-Giri because, in the comments, just before the function declaration, it says "property is a string"
Felipe Yudi
@fyudi
Jul 05 2017 02:07
help guys, what is wrong?
var Bike = function() {

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

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

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



};

var myCar = new Car();


var myBike = new Bike();

myBike.setGear(4);
myBike.gear should remain undefined.
error: myBike.gear should remain undefined.
Manish Giri
@Manish-Giri
Jul 05 2017 02:08
@nanaowusunyamekye if you put `"property"
it becomes the string "property"
no longer the variable property
did I put quotes around the variable in my code on jsbin?
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:09
@Manish-Giri :smirk:
Manish Giri
@Manish-Giri
Jul 05 2017 02:09
:smiling_imp:
fdemaa
@fdemaa
Jul 05 2017 02:10

Guys what should I do ? Use jquery for manipulate the dom, or just use all js, on my first projects ? Any advice ?

I was doing a jquerry course, and its really cool , but i dont know if its good idea to use it

Ogundele Olumide
@Lumexralph
Jul 05 2017 02:11
@fyudi if you do this return this.gear when the object is created by the new opearator, it won't find the property gear in the object... you're to return the private variable gear
Felipe Yudi
@fyudi
Jul 05 2017 02:11
thanks guys! thanks :))))
Nana Owusu
@nanaowusunyamekye
Jul 05 2017 02:12
@Manish-Giri my bad :smile: . changed it and its working now. sorry
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:12
@fyudi class/private variable can be accessed by all the instances of the constructor and it's state can be affected by all instances
Nana Owusu
@nanaowusunyamekye
Jul 05 2017 02:13
@Manish-Giri thanks :thumbsup:
CamperBot
@camperbot
Jul 05 2017 02:13
nanaowusunyamekye sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6186 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:13
@fdemaa my opinion is biased VanillaJS all the way
@Manish-Giri How're you?
Manish Giri
@Manish-Giri
Jul 05 2017 02:13
@nanaowusunyamekye :+1:
@Lumexralph got a headache due to the heat, looking for advil
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:14
@Manish-Giri just woke up too here and i've a bit of cold
@Manish-Giri the question is did you sleep? or have you slept?
Manish Giri
@Manish-Giri
Jul 05 2017 02:29
@Lumexralph it's 10:30 PM here now, and the good news is I'm home, so there's a good chance I'll sleep on time :smile:
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:31
@Manish-Giri good news for me then
how're the queries?
Manish Giri
@Manish-Giri
Jul 05 2017 02:33
fail
my current query is more than 20 lines long
still no result
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:37
you'll get it eventually
vincent5460
@vincent5460
Jul 05 2017 02:42
i did the lesson:var myStr=("\"I am a \"double quoted\" string inside\"double quotes\"\"");why it is not correct?thanks for your reply
the lesson(Escaping Literal Quotes in Strings)
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:47
@vincent5460 you should be escaping only the double quotes in the string, remember than " " initializes a string, so escaping it at the beginning of your string, won't make it a string
@vincent5460 what are the instructions?
vincent5460
@vincent5460
Jul 05 2017 02:48
for me ? i studied before in france
what happened ?
Ogundele Olumide
@Lumexralph
Jul 05 2017 02:56
@vincent5460 should that be a response to the question?
Cesar Mejia
@cesmejia
Jul 05 2017 03:09
Hi, Has anyone here been able to pass the "Show the Local Weather" challenge with the "Dark Sky API" ??????????
I'm stuck with the CORS restriction
and the API Docs says I have to set up a proxy server
but I think there would be an easier way to do it!
Long Nguyen
@longnt80
Jul 05 2017 03:17
@CesMejia let me check if mine still work
@CesMejia ok, use apixu.com. It's much simpler
Cesar Mejia
@cesmejia
Jul 05 2017 03:27
@longnt80 ok let me check that
@CesMejia do you have yours working?
Long Nguyen
@longnt80
Jul 05 2017 03:27
@CesMejia you meant mine?
it's still working
Cesar Mejia
@cesmejia
Jul 05 2017 03:28
@longnt80 and u used apixu?
@longnt80 can I ask you a question that I cannot seem to find anywhere?
@longnt80 In jquery when making an ajax call to a json from another webpage... can I save any of the data returned from the json to a variable and use it outside the ajax call function?
@longnt80 I tried before and I cannot seem to set a global function to use outside the ajax call ... only inside..
Long Nguyen
@longnt80
Jul 05 2017 03:32
@CesMejia good question, I haven't used it like that
let me try it real quick
Cesar Mejia
@cesmejia
Jul 05 2017 03:34
@longnt80 great!
Long Nguyen
@longnt80
Jul 05 2017 03:34
@CesMejia you mean outside of $.getJSON()?
Cesar Mejia
@cesmejia
Jul 05 2017 03:35
@longnt80 outside $.ajax({
url: ,
type: "GET",
dataType : "json",
})
.done(function( json ) {
(I think its the same, but different sintax)
*syntax
Long Nguyen
@longnt80
Jul 05 2017 03:40
@CesMejia no, I can't use it outside
Cesar Mejia
@cesmejia
Jul 05 2017 03:42
@longnt80 it seems that you have to use some sort of "promise" or a callback function
for it to work
@longnt80 thanks anyway!!
CamperBot
@camperbot
Jul 05 2017 03:43
cesmejia sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 426 | @longnt80 |http://www.freecodecamp.com/longnt80
Long Nguyen
@longnt80
Jul 05 2017 03:44
@CesMejia I could be wrong though

@CesMejia

@longnt80 it seems that you have to use some sort of "promise" or a callback function

oh yeah, that makes sense

Joseph
@revisualize
Jul 05 2017 04:30
hello
Jonathan Carroll
@gkcodeman
Jul 05 2017 04:32
i'm trying to do one of my first module.exports and imports. I had everything in a server.js file but wanted to separate my app.get and app.post from the server into their own post.js and get.js files then import them into my server.js file with require. I will post my server.js file and then my post.js file as a reference. Please tell me what I might be doing wrong as I don't yet see how just adding var post = require ('./post.js'); is all i need to connect them. Don't I have to call the post variable somewhere in my code to make it as if it was actually sitting in my server.js file?
```
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var db = mongoose.connect('mongodb://localhost/swag-shop'); //this name can be anything, mongodb databases are named then it creates them itself when you start inserting things
//mongoose.connect('mongodb://localhost:27017/swag-shop'); could also write it this way too 

//require post and get modules below
var post = require('./post.js');
var get = require('./get.js');

//bring in the product and the wishlist you created 
var Product = require('./model/product');
var WishList = require('./model/wishlist');

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: false //extended allows you to parse full objects, false means only strings and arrays whereas true means you can parse any type
}));
//
//
//
//POST USED TO BE HERE 
//
//


//list of products 
//ROUTES
app.get('/product', function (request, response) {
    //this is how we get a list of products below
    //if you use .find it will always give you back and array
    //and you have to get the items out of it first 
    //{} will get them all though
    Product.find({}, function (err, products) {
        if (err) {
            response.status(500).send({
                error: "Could not fetch products"
            });
        } else {
            response.send(products);
        }
    });

});

app.listen(3000, function () {

    console.log("Swaggy Shop API running on port 3000...");
});
and I took out app.post here and put it in its own .js file and need to import whats in it back into the one above (server.js)
```
var exports = module.exports = {};

//ROUTES
//creating an api where we can post products
exports.app.post('/product', function (request, response) {
    var product = new Product();
    //this would be coming from the user or the client
    //we wouldn't just enter random data here, this is an api
    product.title = request.body.title;
    product.price = request.body.price;
    product.save(function (err, savedProduct) {
        if (err) {
            response.status(500).send({
                error: "Could not save product"
            });
        } else {
            response.send(savedProduct);
        }
    });

});
Jonathan Carroll
@gkcodeman
Jul 05 2017 04:39
just watched a vid, its seems that that is all you need. All I have to do is require and its like it is magically placed into server.js as long as post.js has a module.exports pushing it out
CallMeOrange
@EgnaroDev
Jul 05 2017 04:44
Can someone help me with seek and destroy?
Jonathan Carroll
@gkcodeman
Jul 05 2017 04:45
this place is super quiet tonight
CallMeOrange
@EgnaroDev
Jul 05 2017 04:46
yea..
Probably because of the celebrate of July 4th
Jonathan Carroll
@gkcodeman
Jul 05 2017 04:50
true
Ayush Kumar
@Gr8ayu
Jul 05 2017 04:51
I need help ....
Jonathan Carroll
@gkcodeman
Jul 05 2017 04:55
not much here tonight
Manish Giri
@Manish-Giri
Jul 05 2017 04:55
@Gr8ayu what's up
Ayush Kumar
@Gr8ayu
Jul 05 2017 04:56
I am making a small card game with JS , I have card Images in zip file in google drive and I want to use those images . How can I access them without unzipping
Manish Giri
@Manish-Giri
Jul 05 2017 04:56
ask on stack overflow
Ayush Kumar
@Gr8ayu
Jul 05 2017 04:57
@Manish-Giri ok thanks
CamperBot
@camperbot
Jul 05 2017 04:57
gr8ayu sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6187 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ogundele Olumide
@Lumexralph
Jul 05 2017 04:59
@Manish-Giri ready for some questions?
Manish Giri
@Manish-Giri
Jul 05 2017 05:00
lol
i'm solving a codewars problem that has blown my mind away
but ask away :smiling_imp:
@Lumexralph
Ogundele Olumide
@Lumexralph
Jul 05 2017 05:02
@Manish-Giri away, i'm on same issue, how do you handle bigger numbers in JS larger than Number.MAX_VALUE
@Manish-Giri avoiding overflow of 15 digits displayed as Infinity from the calculations
@Manish-Giri what codewars problem is that?
Dhaval
@Dhavalc2012
Jul 05 2017 05:04
hey dude
nope i wont be asking u
maybe something here will help
Number.MAX_SAFE_INTEGER = Math.pow(2, 53)-1;
CallMeOrange
@EgnaroDev
Jul 05 2017 05:05
@Dhavalc2012 ask who?
Manish Giri
@Manish-Giri
Jul 05 2017 05:05
@Dhavalc2012 :wave:
Ogundele Olumide
@Lumexralph
Jul 05 2017 05:05
@Manish-Giri what challenge are you working on?
@MCTwoDigitZero @Dhavalc2012 :wave:
CallMeOrange
@EgnaroDev
Jul 05 2017 05:06
Yo
Dhaval
@Dhavalc2012
Jul 05 2017 05:06
@Manish-Giri this guy :P I dont ask him
CallMeOrange
@EgnaroDev
Jul 05 2017 05:06
lol
Dhaval
@Dhavalc2012
Jul 05 2017 05:06
ur profile pic is intimidating lol @MCTwoDigitZero
CallMeOrange
@EgnaroDev
Jul 05 2017 05:06
Thanks
Dhaval
@Dhavalc2012
Jul 05 2017 05:06
whats codewars btww
is it part of fcc
CallMeOrange
@EgnaroDev
Jul 05 2017 05:07
Took a screenshot of this :shipit:
@Dhavalc2012 no its a website where you can solve algs by yourself
Something like that
Dhaval
@Dhavalc2012
Jul 05 2017 05:07
ahh like hackathon
i suppose
i will try it out but i m afraid i also lose focus when something comes up
Dhaval
@Dhavalc2012
Jul 05 2017 05:08
need to sort out my issue of priority
CallMeOrange
@EgnaroDev
Jul 05 2017 05:08
You should, and I'd prefer codefight
Manish Giri
@Manish-Giri
Jul 05 2017 05:08
@Dhavalc2012 - naukri, chokri, daaru <- Priority
Dhaval
@Dhavalc2012
Jul 05 2017 05:09
lol
no daaru for me
got naukri as well as chokri ;)
CallMeOrange
@EgnaroDev
Jul 05 2017 05:10
What does it say? :p
Manish Giri
@Manish-Giri
Jul 05 2017 05:10
no daaru for me too
but no chokri filhaal
Dhaval
@Dhavalc2012
Jul 05 2017 05:10
it says work -> gf -> drinks as priority
Manish Giri
@Manish-Giri
Jul 05 2017 05:10
:sob:
CallMeOrange
@EgnaroDev
Jul 05 2017 05:10
lol
Dhaval
@Dhavalc2012
Jul 05 2017 05:10
yeah u shouldnt have chokri
CallMeOrange
@EgnaroDev
Jul 05 2017 05:10
I thought it was a hindi or something
Dhaval
@Dhavalc2012
Jul 05 2017 05:10
yeah it is
Manish Giri
@Manish-Giri
Jul 05 2017 05:10
chal
Dhaval
@Dhavalc2012
Jul 05 2017 05:11
u have such a bad luck with them :P
Manish Giri
@Manish-Giri
Jul 05 2017 05:11
bina chokri ke baba ramdev banna hai kya
lol
CallMeOrange
@EgnaroDev
Jul 05 2017 05:11
Really? then Hindi to English translator didnt work..
Dhaval
@Dhavalc2012
Jul 05 2017 05:11
btw that maturity stuff was amazing
Manish Giri
@Manish-Giri
Jul 05 2017 05:11
yes
hats off
Dhaval
@Dhavalc2012
Jul 05 2017 05:11
last two parts were
out of the world haha
CallMeOrange
@EgnaroDev
Jul 05 2017 05:11
so..
Manish Giri
@Manish-Giri
Jul 05 2017 05:11
I liked the quora over fb one
and career over girl one
CallMeOrange
@EgnaroDev
Jul 05 2017 05:11
I read Quora all time
Dhaval
@Dhavalc2012
Jul 05 2017 05:11
yeah because it was kind of shortcut thats why didnt work @Manish-Giri
@MCTwoDigitZero
OldmanVimes
@OldmanVimes
Jul 05 2017 05:12
  var length=str.length;
  if (str.length>num){
  str=str.slice(0,num-3);
  return str+='...';
  }
  else if (num<=3){
    str=str.slice(0,num);
    return str+='...';
  }
  else{ str=str.slice(0,num);
       return str;

  }
}
What am I doing wrong,? Two test cases are coming negative.
Dhaval
@Dhavalc2012
Jul 05 2017 05:12
me too
we are quora adicted
CallMeOrange
@EgnaroDev
Jul 05 2017 05:12
Yeah
Dhaval
@Dhavalc2012
Jul 05 2017 05:12
i usally read it while traveling
CallMeOrange
@EgnaroDev
Jul 05 2017 05:12
I believe Quora is most addicted app I have ever had
Dhaval
@Dhavalc2012
Jul 05 2017 05:12
or just at home n want to rest
my mind always runs even while resting
:laughing:
CallMeOrange
@EgnaroDev
Jul 05 2017 05:12
@Dhavalc2012 Are you good at JS?
Dhaval
@Dhavalc2012
Jul 05 2017 05:12
yeah
and even medium
recently there are some amazing good stuff in medium
i guess so
CallMeOrange
@EgnaroDev
Jul 05 2017 05:13
Can you help me with Seek and Destroy?
Dhaval
@Dhavalc2012
Jul 05 2017 05:13
yeah what that
CallMeOrange
@EgnaroDev
Jul 05 2017 05:13
...
Dhaval
@Dhavalc2012
Jul 05 2017 05:13
FCC challenge?
CallMeOrange
@EgnaroDev
Jul 05 2017 05:13
An algorithm from Basic Algorithms Scripting
Yeah
Dhaval
@Dhavalc2012
Jul 05 2017 05:13
ahh let me check it out wait
CallMeOrange
@EgnaroDev
Jul 05 2017 05:13
Sure
Dhaval
@Dhavalc2012
Jul 05 2017 05:13
havent done it in quite a while
Manish Giri
@Manish-Giri
Jul 05 2017 05:14
@Dhavalc2012 x
CallMeOrange
@EgnaroDev
Jul 05 2017 05:14
lmao
Dhaval
@Dhavalc2012
Jul 05 2017 05:14
haha what was that abt
i was on vacation u forgot :P
CallMeOrange
@EgnaroDev
Jul 05 2017 05:15
President of India?
I can google it, no need to answer that question ^
Dhaval
@Dhavalc2012
Jul 05 2017 05:16
so did u find it out
CallMeOrange
@EgnaroDev
Jul 05 2017 05:18
Yeah I did google it but not sure if it is the same person...
OldmanVimes
@OldmanVimes
Jul 05 2017 05:18
  var length=str.length;
  if (str.length>num){
  str=str.slice(0,num-3);
  return str+='...';
  }
  else if (num<=3){
    str=str.slice(0,num);
    return str+='...';
  }
  else{ str=str.slice(0,num);
       return str;

  }
}
What am I doing wrong,? Two test cases are coming negative.
CallMeOrange
@EgnaroDev
Jul 05 2017 05:18
@OldmanVimes What are you working on?
OldmanVimes
@OldmanVimes
Jul 05 2017 05:18
string truncation
CallMeOrange
@EgnaroDev
Jul 05 2017 05:18
ah
else{ str=str.slice(0,num)
You should have else if?
and you can just return str instead
Manish Giri
@Manish-Giri
Jul 05 2017 05:33
@Dhavalc2012 x
CallMeOrange
@EgnaroDev
Jul 05 2017 05:35
lol
Delgado
@YangPengFe1
Jul 05 2017 06:21

// 初始化变量
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;

// 给变量赋值
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

var studlyCapVar = 10;
var properCamelCase = 'A String';
var titleCaseOver = 9000;

Joseph
@revisualize
Jul 05 2017 06:30
@YangPengFe1 you have to fix the var declaration and assignment
Chris Juchtmans
@kjuchtmans
Jul 05 2017 06:30
Good morning Coders! DaJia Nihao! :wave:
Joseph
@revisualize
Jul 05 2017 06:30
@YangPengFe1 doing this:
var studlyCapVar = 10;
var properCamelCase = 'A String';
var titleCaseOver = 9000;
...
doesnt work
Delgado
@YangPengFe1
Jul 05 2017 06:31
@revisualize 谢谢啊。兄弟。
Joseph
@revisualize
Jul 05 2017 06:33
@YangPengFe1 var StUdLyCapVaR; fix to: var studlyCapVar;
Chris Juchtmans
@kjuchtmans
Jul 05 2017 06:33

"Search and Replace" assignment : who cares to share an solution using Arrays?
I chose to go the String route, somehow seems more intuitive to me, when a string is given.
SPOILER ALERT!

solution below

my code:

function myReplace(str, before, after) {
  var newAfter,
      index,
      newStr;

// step 1 match initial letters of `before` and `after`
  if (/^[A-Z]/.test(before) === true){
   newAfter = after.charAt(0).toUpperCase() + after.slice(1);
  } else {
   newAfter = after.charAt(0).toLowerCase() + after.slice(1);    
  }
  // step 2 locate `before` in string by obtaining its index
  index = str.indexOf(before);
 // step 3 replace `before` by `after` at `index` using concatenated substring
  newStr = str.substr(0, index) + newAfter + str.substr(index + before.length); 
  return newStr;
}

myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");
Joseph
@revisualize
Jul 05 2017 06:33
@YangPengFe1 fix the text in place
Delgado
@YangPengFe1
Jul 05 2017 06:33
ok
Joseph
@revisualize
Jul 05 2017 06:35

@kjuchtmans my solutions:


function myReplace(str, before, after) {
    return str.replace(before, (x) => (before.charCodeAt(0) >= 65 && before.charCodeAt(0) <= 90) ? after = after[0].toUpperCase() + after.slice(1) : after);
}

&&

function myReplace(str, before, after) {
  if (before.charCodeAt(0) >= 65 && before.charCodeAt(0) <= 90) {
    after = after[0].toUpperCase() + after.slice(1);
  }
  return str.replace(before, after);
}
Chris Juchtmans
@kjuchtmans
Jul 05 2017 06:36
@revisualize thanks, interesting solution!
CamperBot
@camperbot
Jul 05 2017 06:36
kjuchtmans sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4305 | @revisualize |http://www.freecodecamp.com/revisualize
Long Nguyen
@longnt80
Jul 05 2017 07:13
Anyone familiar with the Web Audio API?
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:14

@OldmanVimes Beyond what was said, the first thing you should check for is whether the string doesn't need to be truncated at all. Currently, if num is 3 or less, it will truncate your string regardless of whether it actually needs to be (e.g. if string length is 2, and num is 3, does it need to be truncated?). Also, I wouldn't assign str.length to a variable if you're not going to use said variable.

I'd also have slice and '...' dealt with on same line and return then and there.

If you consider carefully what is logically happening, you can cut the entire function down to five lines of code ... five reasonable lines of code, I might add. :p

kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:21

@longnt80 I'd like to say yes, since chatroom seems dead as a doornail.

But no. :/

Long Nguyen
@longnt80
Jul 05 2017 07:22
@kumquatfelafel haha
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:23
@longnt80 What are you trying to do? I could be like a set of mostly useless eyes that just happens to spot something every fifty years or so.
Delgado
@YangPengFe1
Jul 05 2017 07:23
  • -!
--!
Long Nguyen
@longnt80
Jul 05 2017 07:23
@kumquatfelafel I use the Web Audio API to create the sound for my Simon Game
Delgado
@YangPengFe1
Jul 05 2017 07:24
我想帮住你 但是我英文 不好
Long Nguyen
@longnt80
Jul 05 2017 07:24
but there is a bug when I click between the buttons fast enough
Delgado
@YangPengFe1
Jul 05 2017 07:25
i want to help u but my english is poor
Long Nguyen
@longnt80
Jul 05 2017 07:25
@YangPengFe1 oh
Delgado
@YangPengFe1
Jul 05 2017 07:25
@longnt80 n
@longnt80 what is meaning
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:27
@longnt80 will try testing out, sec.
Long Nguyen
@longnt80
Jul 05 2017 07:27
@YangPengFe1 I could use Google translate
Delgado
@YangPengFe1
Jul 05 2017 07:27
i am sorry i didn't quite understand
Long Nguyen
@longnt80
Jul 05 2017 07:27
@kumquatfelafel ok thanks
CamperBot
@camperbot
Jul 05 2017 07:27
longnt80 sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 436 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Delgado
@YangPengFe1
Jul 05 2017 07:28
i use youdao tanslate
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:29
@longnt80 So... I'm ashamed to say, I can't seem to click fast enough. Oh... wait. yeah I just got it :laughing:
Long Nguyen
@longnt80
Jul 05 2017 07:30
@kumquatfelafel lol, sorry if it breaks your mouse
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:31
Another thing I got was a visual of the simon board to the side on occasion. Though I'm not sure what that was (whether like a mouse drag thing or something else)
Hrm. Yup. Sound still going. I assume this is what you were talking about?
Long Nguyen
@longnt80
Jul 05 2017 07:33
yes
since you mentioned drag
I tried to click the button and drag the mouse outside, the sound still goes on even though I used the event mouseleave
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:35
@longnt80 It's essentially starting and stopping a different sound when you do that is the problem.
I think.
Long Nguyen
@longnt80
Jul 05 2017 07:37
I think when clicking fast like that, a sound is not stopped
so when I click again, it create another sound source, but the old one is still there
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:44
Lemme check web audio stuff for sec
Dhaval
@Dhavalc2012
Jul 05 2017 07:45
@MCTwoDigitZero I thought about that seek and destroy and I have one solution but I dont like the time complexity of it as it is very big. You can store the first array as it is and take rest of the parameters as an array. Loop through this array and compare it with the orignal array . Either use directly filter or rather replace that array with something random or a single value of the second array and then apply filter only for that single value so that u will avoid applying filter again n again for same thing
kumquatfelafel
@kumquatfelafel
Jul 05 2017 07:48
@longnt80 (If there were a way to consume previous event when button clicked as failsafe, that would be nice. But not sure how something like that work in javascript) :p
Long Nguyen
@longnt80
Jul 05 2017 07:50
@kumquatfelafel you meant deleting the previous event?
Long Nguyen
@longnt80
Jul 05 2017 08:00
@kumquatfelafel I think I found the problem
kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:01
@longnt80 Well... not entirely sure how the web audio works. But if previous sound(s) is visible inside click function, you can call stop on them there if they haven't been stopped already. Though I imagine this is a pretty bad solution though.
@longnt80 what's up?
Long Nguyen
@longnt80
Jul 05 2017 08:02
@kumquatfelafel I think it has something to do with the mousedown, mouseup, mouseleave events
I just added the mouseenter event
now if you hover, it also trigger the sound
but
you hover and click then the sound will goes on without stopping
kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:04
yup
Long Nguyen
@longnt80
Jul 05 2017 08:06
not sure how to do anything about that though
basically, the audio is created by an oscillator
kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:07
@longnt80 So one thing I will say is that times I've gotten it without mouse enter, has seemed to coincide with the board, or pieces of it appearing to side of screen.
Will Waymel
@willwaymel
Jul 05 2017 08:08
@longnt80 maybe it has something to do with phantom events/double events firing...
kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:08
@willwaymel I'm wondering about that.
there are a few different conditions in there.
Long Nguyen
@longnt80
Jul 05 2017 08:09

@longnt80 So one thing I will say is that times I've gotten it without mouse enter, has seemed to coincide with the board, or pieces of it appearing to side of screen.

I can't seem to reproduce this appearing to the side bug

kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:10
@willwaymel so far, tried removing all except mouse down, when only mouse down, bug still caused, in fact, seemed even more prone.
about to try others.
Long Nguyen
@longnt80
Jul 05 2017 08:10
@kumquatfelafel yeah I saw the same thing
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:10
hello everyone
Long Nguyen
@longnt80
Jul 05 2017 08:10
mousedown only also cause the bug
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:11
var moneyinregiser = cid.reduce(function(acc,next){
    return acc + next[1];
  },0.0).toFilter(2);
what im doign wrong here?
kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:11
@longnt80 and mousedown + touchstart = bug.
Pieter Stokkink
@forkerino
Jul 05 2017 08:11
@tiagocorreiaalmeida what is .toFilter?
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:12
wait that's not what I wanted I learned something new yesterday but confusing it
its a thing that picks imagine a number like 5,632
and if I say that(2);
it picks the number and returns 5,63
Pieter Stokkink
@forkerino
Jul 05 2017 08:12
You mean .toFixed?
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:13
you know the awnser always, thanks :)
Pieter Stokkink
@forkerino
Jul 05 2017 08:13
:+1:
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:13
var money = [
  {name:"ONE HUNDRED",   value:100.00},
  {name:"TWENTY",        value:20.00},
  {name:"TEN",           value:10.00},
  {name:"FIVE",          value:5.00},
  {name:"ONE",           value:1.00},
  {name:"QUARTER",       value:0.25},
  {name:"DIME",          value:0.10},
  {name:"NICKEL",        value:0.05},
  {name:"PENNY",         value:0.01}
];
// Example cash-in-drawer array:
// [["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]]

function checkCashRegister(price, cash, cid) {
  var change;
  // Here is your change, ma'am.
  change = cash-price;
  var moneyinregiser = cid.reduce(function(acc,next){
    return acc + next[1];
  },0.0).toFixed(2);
  if(moneyinregiser == change){
    return "Closed";
  }else if(moneyinregiser < change){
    return "Insufficient Funds";
  }
  return change;
}

checkCashRegister(19.50, 20.00, [["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]]);
im at this point but a bit confused in what to do next
Pieter Stokkink
@forkerino
Jul 05 2017 08:15
@tiagocorreiaalmeida make an array and fill it with the change you need to give. Start from the biggest denomination and put as much in it as you can
Will Waymel
@willwaymel
Jul 05 2017 08:16

anyone know why this works

    args.forEach( function(value, index, array) {
    setTimeout(function() {

but this does not

  args.forEach(function(value, index) {
      self.timeouts.push(setTimeout(function() {

it works elsewhere in my code with a forEach... and the timer id is getting added, but the actual code in the timer doesn't fire unless i remove the self.timeouts.push() around the setTimeout

kumquatfelafel
@kumquatfelafel
Jul 05 2017 08:17
@longnt80 hrm. Well looks like chat less dead now. And since this is one of those "wake up in middle of night and do things for an hour or two" type scenarios.... I'm going back to bed. Night (and g'luck)
Long Nguyen
@longnt80
Jul 05 2017 08:18
@kumquatfelafel thanks
CamperBot
@camperbot
Jul 05 2017 08:18
longnt80 sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:warning: longnt80 already gave kumquatfelafel points
Long Nguyen
@longnt80
Jul 05 2017 08:18
good night
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:18
like I need to pay 1.00 if five > change go down on the value and further ad further?
Pieter Stokkink
@forkerino
Jul 05 2017 08:19
@tiagocorreiaalmeida not sure I understand your explanation
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:20
what I mean is I need to give back 1.00 so I run trough the money array and check every value imagine if 5 is bigger than 1 I can't pay with the 5.00 so I need to go down to the quarter 0.25 right?
Long Nguyen
@longnt80
Jul 05 2017 08:20
@willwaymel what is this self.timeouts.push?
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:20
but at the same time I need to remove that cash from the cid so I need to reverse the array so I can use the same index to remove from the cd and push into the result
Will Waymel
@willwaymel
Jul 05 2017 08:21
@longnt80 self.timouts is an array of my timer ids that i cancel all if i turn off my simon game... (self being the var self = this)
Pieter Stokkink
@forkerino
Jul 05 2017 08:21
@tiagocorreiaalmeida how you do it is up to you, but that's the general idea
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:22
ok thanks will try to figure this out, so how did that job thing ended up?
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:22
@forkerino :Bro!
Pieter Stokkink
@forkerino
Jul 05 2017 08:22
Got hired, enjoying it a lot
Tiago Correia
@tiagocorreiaalmeida
Jul 05 2017 08:23
hell yeah :+1:
Pieter Stokkink
@forkerino
Jul 05 2017 08:23
@Lumexralph :wave:
Long Nguyen
@longnt80
Jul 05 2017 08:23
@willwaymel maybe try to console.log(self) to see what value it returns
JHnnis
@JHnnis
Jul 05 2017 08:23

function factorialize(num) {
  var numbers = []; 
  for (var i = 1; i< num; i++) {
    numbers.push(i);
  }

  var ans = numbers.reduce(Math.imul);

  return  ans*num;
}

factorialize(20);
Will Waymel
@willwaymel
Jul 05 2017 08:23
@longnt80 i'm starting to think maybe i'm clearing the timer before calling it when i add it to the timers array, so i must look at the timing of when i clear the timers. that's gotta be it
@longnt80 thanks
CamperBot
@camperbot
Jul 05 2017 08:24
willwaymel sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 428 | @longnt80 |http://www.freecodecamp.com/longnt80
Long Nguyen
@longnt80
Jul 05 2017 08:24
@willwaymel I'd ask for your code but then I'm also working on Simon game so I don't want any spoiler
Will Waymel
@willwaymel
Jul 05 2017 08:24
@longnt80 haha
Pieter Stokkink
@forkerino
Jul 05 2017 08:24
@JHnnis what is Math.imul?
Will Waymel
@willwaymel
Jul 05 2017 08:24
@longnt80 no worries... just talking this through helps me
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:24
@JHnnis what's Math.imul meant to do ?
JHnnis
@JHnnis
Jul 05 2017 08:24
@forkerino it multiplys all numbers in my array
Chris Juchtmans
@kjuchtmans
Jul 05 2017 08:25
hey all! :wave:
Pieter Stokkink
@forkerino
Jul 05 2017 08:25
@JHnnis I don't know that method
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:25
@JHnnis you can also avoid the last statement by doing i <= num in the loop to include 20
wonder
@wonder2991
Jul 05 2017 08:26
your factorialize is complicated
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:26
@forkerino same here @JHnnis
Chris Juchtmans
@kjuchtmans
Jul 05 2017 08:26
"Pig Latin" :
Who considers the letter Y a consonant, and who says vowel?
At uni I was taught can be both, depending on language
JHnnis
@JHnnis
Jul 05 2017 08:26
@Lumexralph and the it'll work? because its working until "20" and "0"
wonder
@wonder2991
Jul 05 2017 08:28
@kjuchtmans aeiou are vowels. that's all you need for the challenge
Pieter Stokkink
@forkerino
Jul 05 2017 08:28
@JHnnis it is easier to just multiply a variable in your loop, but I guess it might work with your .reduce
Chris Juchtmans
@kjuchtmans
Jul 05 2017 08:28
@wonder2991 deal.
Pieter Stokkink
@forkerino
Jul 05 2017 08:29
You might get an error for empty arrays @JHnnis
Maybe give a second argument to reduce
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:30
@JHnnis you understand the way reduce works, right?
JHnnis
@JHnnis
Jul 05 2017 08:31
@Lumexralph it should multiply all numbers in the array
@Lumexralph the problem with zero is clear to me, I have to avoid that the loop counts 0 if factorialize is ">1", because the product will always be 0. But how to solve the problem if factorialize = 0 ?
shivam gupta
@shivamg11000
Jul 05 2017 08:34
how to make the setInterval pause for my pomodro clock,
https://codepen.io/shivamg11000/pen/VWdYqR?editors=0011
JHnnis
@JHnnis
Jul 05 2017 08:36
@forkerino the thing is it works well until number 20, but when i calculate it on the browser it doesn't fit to the required result, too.
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:39
@JHnnis maybe you should pay more attention to this The result of the C-like 32-bit multiplication of the passed parameters.
@JHnnis that's the result of using Math.imul
Long Nguyen
@longnt80
Jul 05 2017 08:41
@shivamg11000 clearInterval
shivam gupta
@shivamg11000
Jul 05 2017 08:41
@longnt80 I have to pause setInterval , not stop
JHnnis
@JHnnis
Jul 05 2017 08:42
@Lumexralph so it's better to multiply inside the loop?
Ogundele Olumide
@Lumexralph
Jul 05 2017 08:44
@JHnnis just use a callback that multiplies accumulator with nextValue in reduce method
Long Nguyen
@longnt80
Jul 05 2017 08:46
@shivamg11000 there's nothing as pause setInterval, you have to use clearInterval, then store the current time in a variable then when setInterval again, you'd run setInterval on that stored time again
2895388807
@2895388807
Jul 05 2017 08:47

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// 请把你的代码写在这条注释以下
result = wordBlank[0];

// 请把你的代码写在这条注释以上
return result;
}

wordBlanks("dog", "That big brown", "just run", "quickly"); // 你可以修改这一行来测试你的代码

Ogundele Olumide
@Lumexralph
Jul 05 2017 08:47
@JHnnis
var ans = numbers.reduce((acc, nextValue) => acc * nextValue,  1);
2895388807
@2895388807
Jul 05 2017 08:47
something wrong with it ?
heroiczero
@heroiczero
Jul 05 2017 08:48
@2895388807 you need to make a sentence with (myNoun, myAdjective, myVerb, myAdverb)
Victor Popescu
@VicPopescu
Jul 05 2017 08:49
@2895388807 form a string with the correct order of those parameters, then return that string, that's all
2895388807
@2895388807
Jul 05 2017 08:49
thank you
JHnnis
@JHnnis
Jul 05 2017 08:54
@Lumexralph ah thanks alot man :fire:
CamperBot
@camperbot
Jul 05 2017 08:54
jhnnis sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 2020 | @lumexralph |http://www.freecodecamp.com/lumexralph
gadzet
@gadzet
Jul 05 2017 08:56
store
  .dispatch(fetchChannels(selectedChannel.id))
  .then(() => console.log(store.getState()))
How do i render the object from the store in redux ?
Claudio Restifo
@Marmiz
Jul 05 2017 09:29
@gadzet dispatch your action. The action gets registered in the reducer. Update the state. The state automatically pushes a new prop to all the components that are listening to it
Alan Alickovic
@alan2207
Jul 05 2017 09:30
@gadzet you need to use connect() method from react-redux on your container component
Finn Pegler
@FinnPegler
Jul 05 2017 09:54

I am trying to capitalise the first letter of each word in a string. I know the "a" variable is the wrong method but how do I correctly pass the initial string into my function?

String.prototype.toJadenCase = function (a) {

str2 = a.split(" ");
newStr = [];
for (var i in str2){
newStr[i] = str2[i].charAt(0).toUpperCase() + str2[i].substr(1);
}
return newStr.join(" ");
};

var str = "How can mirrors be real if our eyes aren't real";
str.toJadenCase();

Delgado
@YangPengFe1
Jul 05 2017 09:59
look this

@FinnPegler function titleCase1(str) {
//将字符串分解为数组并将其小写化
var convertToArray = str.toLowerCase().split(" ");

for (var i = 0; i < convertToArray.length; i++) {  
    var char = convertToArray[i].charAt(0);  
    //使用 replace()方法将数组中的每个首字母大写化  
    convertToArray[i] = convertToArray[i].replace(char, function replace(char) {  
        return char.toUpperCase();  
    });  
}  
return convertToArray.join(" ");  

}

function titleCase1(str) {

var convertToArray = str.toLowerCase().split(" ");  

for (var i = 0; i < convertToArray.length; i++) {  
    var char = convertToArray[i].charAt(0);  

    convertToArray[i] = convertToArray[i].replace(char, function replace(char) {  
        return char.toUpperCase();  
    });  
}  
return convertToArray.join(" ");  

}

nohitha
@nohitha
Jul 05 2017 10:06
someone help me out with counting cards code here is the link https://www.freecodecamp.com/challenges/counting-cards
gadzet
@gadzet
Jul 05 2017 10:12
@alan2207 @Marmiz figured it out myself but came across another problem, how can i get a state of another reducer
anyone knows that ?
tell me if u need code example
Claudio Restifo
@Marmiz
Jul 05 2017 10:13
@gadzet you usually plug in different reducers together
gadzet
@gadzet
Jul 05 2017 10:13
i use the combineReducers function but it is then outside of the scope
Alan Alickovic
@alan2207
Jul 05 2017 10:14
gadzet
@gadzet
Jul 05 2017 10:14
image.png
i am in schedulesBychannel
and i need to get selected channel
somehow
this is the connected props
image.png
function selectedChannel(state = 'all', action) {
  switch (action.type) {
    case SELECT_CHANNEL:
      return action.id
    default:
      return state
  }
}
function channels(
  state = {
    isFetching: false,
    didInvalidate: false,
    items: []
  },
  action
) {
  switch (action.type) {
    case REQUEST_CHANNELS:
      return Object.assign({}, state, {
        isFetching: true,
        didInvalidate: false
      })
    case RECEIVE_CHANNELS:
      return Object.assign({}, state, {
        isFetching: false,
        didInvalidate: false,
        test: Object.selectedChannel,
        items: action.channels,
        lastUpdated: action.receivedAt
      })
    default:
      return state
  }
}
The test in RECEIVE CHANNELS should get the selectedChannel state value
Finn Pegler
@FinnPegler
Jul 05 2017 10:23

I am trying to capitalise the first letter of each word in a string. I know the "a" variable is the wrong method but how do I correctly pass the initial string into my function? The first line (String.prototype.toJadenCase = function () {) I don't really understand, but it needs to be in that format because it is for a coding exercise on CodeWars.

String.prototype.toJadenCase = function () {

str2 = a.split(" ");
newStr = [];
for (var i in str2){
newStr[i] = str2[i].charAt(0).toUpperCase() + str2[i].substr(1);
}
return newStr.join(" ");
};

var str = "How can mirrors be real if our eyes aren't real";
str.toJadenCase();

Stephen James
@sjames1958gm
Jul 05 2017 10:27
@FinnPegler Since you are assigning the function to the String prototype the string to convert will be in the this variable
Finn Pegler
@FinnPegler
Jul 05 2017 10:27
@sjames1958gm Thanks!
CamperBot
@camperbot
Jul 05 2017 10:27
finnpegler sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7989 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Finn Pegler
@FinnPegler
Jul 05 2017 10:28
@sjames1958gm What is the point of assigning the function to the String prototype?
Stephen James
@sjames1958gm
Jul 05 2017 10:29
@FinnPegler to make the function a "String" function similar to substr or split you can call it directly on a string.
so str.toJadenCase()
gadzet
@gadzet
Jul 05 2017 10:32
@sjames1958gm do you mabye have answer to my question above ?
i figured out that redux thunk should be used but not more yet
Finn Pegler
@FinnPegler
Jul 05 2017 10:34
Gotcha thanks
Stephen James
@sjames1958gm
Jul 05 2017 10:37
@gadzet I don't believe you an access the state of another reducer inside a reducer
@gadzet can you put it in the action payload?
gadzet
@gadzet
Jul 05 2017 10:42
yeah this is how i do it per today
but i dont know how good practice is it
thanks anyway @sjames1958gm
CamperBot
@camperbot
Jul 05 2017 10:42
gadzet sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7990 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ayush Mahajan
@ay2306
Jul 05 2017 11:02
hey guys how can I pause JS program in between for a specific period?
Rakesh Goswami
@theunmarwadi
Jul 05 2017 11:16
Which is the best place to practice javascript?
alpox
@alpox
Jul 05 2017 11:17
@theunmarwadi FCC? :D
Rakesh Goswami
@theunmarwadi
Jul 05 2017 11:19
not to learn . I mean i know the basics but i want to practice them and make my basics stronger!
Alan Alickovic
@alan2207
Jul 05 2017 11:19
@theunmarwadi codewars
Rakesh Goswami
@theunmarwadi
Jul 05 2017 11:20
More??
Alan Alickovic
@alan2207
Jul 05 2017 11:22
codefights, codinggame, exercism.io
h1tag
@h1tag
Jul 05 2017 11:22
more? :p
Rakesh Goswami
@theunmarwadi
Jul 05 2017 11:22
thanks a lot @alan2207 bro!
CamperBot
@camperbot
Jul 05 2017 11:22
theunmarwadi sends brownie points to @alan2207 :sparkles: :thumbsup: :sparkles:
:cookie: 482 | @alan2207 |http://www.freecodecamp.com/alan2207
Adri Jenie
@Adrifajar
Jul 05 2017 11:29
guys. im doing "Check for Palindromes" challenge.
and i don't know how to delete any non-alphanumerical string
i already try to use str.replace(/\W/g, '')
but it does not work
nvm it does remove it
wonder
@wonder2991
Jul 05 2017 11:32
your code @Adrifajar
Diego Mayer
@Chrono79
Jul 05 2017 11:39
@Adrifajar it doesn't remove all the non-alphanumeric
underscore is still there
Kevin
@kevinwr
Jul 05 2017 11:46
@Adrifajar check into Regular Expressions. That's how I was able to solve it
Stephen James
@sjames1958gm
Jul 05 2017 11:48
@ay2306 You can use set timeout to run js code at some time in the future
gadzet
@gadzet
Jul 05 2017 11:48
          const list = items.channels.map((channel) =>
            <div>aa</div>
          );
I have a map function that for each array element is printing a div. The problem is that under channel there is another array called schedule, how do i map it ?
the following did not work
const list = items.channels.map((channel => channel.map( schedule )) =><div>aa</div> 34 | );
Stephen James
@sjames1958gm
Jul 05 2017 11:54
const list = items.channels.map(channel => (channel.map(schedule => <div>aa</div>)));
gadzet
@gadzet
Jul 05 2017 11:57
Unhandled Rejection (TypeError): channel.map is not a function
Stephen James
@sjames1958gm
Jul 05 2017 11:57
@gadzet is channel an array, or is there a property of channel that is an array?
Like:
const list = items.channels.map(channel => (channel.schedules.map(schedule => <div>aa</div>)));
gadzet
@gadzet
Jul 05 2017 11:58
image.png
sorry it schedules
but it was not there it failed
now it worked!
Stephen James
@sjames1958gm
Jul 05 2017 11:59
:+1:
gadzet
@gadzet
Jul 05 2017 11:59
thanks again @sjames1958gm
CamperBot
@camperbot
Jul 05 2017 11:59
gadzet sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7991 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
gadzet
@gadzet
Jul 05 2017 12:02
is there any way to sort it by the property value ?
or it has to be done before the mapping
Stephen James
@sjames1958gm
Jul 05 2017 12:08
before the mapping.
gadzet
@gadzet
Jul 05 2017 12:09

          foreach($channels as $channel) {
              echo $channel->name;
              foreach($channel->schedules as $schedule) {
                  echo $schedule->name;
              } 
          }
how could i achieve something like this with mapping ?
no it will just print everythin not categorised
Ayush Mahajan
@ay2306
Jul 05 2017 12:09

@gadzet I have question
suppose this is my code

using setTimout(function(){/*some_code_snippet_1*/},3seconds);
//some_code_snippet_2

So I understand that some_code_snippet_1 will run after 3 seconds but what about some_code_snippet_2 will it run after some_code_snippet_1 or when?

assume syntax to be correct
gadzet
@gadzet
Jul 05 2017 12:10
some code snippet will run imidiatly
Stephen James
@sjames1958gm
Jul 05 2017 12:10
@ay2306 code snippet two will run immediately
gadzet
@gadzet
Jul 05 2017 12:10
it is outside the scope of timeout
Ayush Mahajan
@ay2306
Jul 05 2017 12:11
@gadzet That will create a problem. See I have an algorithm which is working fast but I want to give computer a hold so that I could show as if computer is thinking any idea how could I do that?
Stephen James
@sjames1958gm
Jul 05 2017 12:12
@ay2306 put the algorithm in a function and pass that function to setTimeout to run in the future
Ayush Mahajan
@ay2306
Jul 05 2017 12:12
@sjames1958gm let me try that
Stephen James
@sjames1958gm
Jul 05 2017 12:12
That is what I did for my tic tac toe computer move
gadzet
@gadzet
Jul 05 2017 12:16
const list = items.channels.map(channel => 
    (channel.schedules.map(schedule => 
            <div><ul>
                <h1>{channel.title}</h1>
            <li>
                {schedule.title}
            </li>
            </ul></div>
)));
@sjames1958gm this will give me one undertitle per title
image.png
Stephen James
@sjames1958gm
Jul 05 2017 12:17
@gadzet you'll probably have to move the channel.title outside the inner map
gadzet
@gadzet
Jul 05 2017 12:17
how do i get one title for all undertitles
yeah but i dont really get js syntax yet tried just after first arrow but it gave me error
Stephen James
@sjames1958gm
Jul 05 2017 12:19
items.channels.map(channel => {
   let s = channel.schedules.map(schedule => 
            <li>
                {schedule.title}
            </li>;
   return (<div>                
                  <h1>{channel.title}</h1>
                   <ul>
                  {s}      
            </ul></div>)
Or something to that effect
gadzet
@gadzet
Jul 05 2017 12:22
whwre does the curly brace ends ?
after return
Stephen James
@sjames1958gm
Jul 05 2017 12:22
@sjames1958gm yes
gadzet
@gadzet
Jul 05 2017 12:23
compiler does not like the semicolumn
Stephen James
@sjames1958gm
Jul 05 2017 12:23
This might work as well
const list = items.channels.map(channel => 
    ( 
            <div><ul>
                <h1>{channel.title}</h1>
            <li>
                {channel.schedules.map(schedule => schedule.title)}
            </li>
            </ul></div>
));
gadzet
@gadzet
Jul 05 2017 12:24
damn your smart
thanks @sjames1958gm
CamperBot
@camperbot
Jul 05 2017 12:24
gadzet sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: gadzet already gave sjames1958gm points
gadzet
@gadzet
Jul 05 2017 12:24
how long are u working with es2015
would be better to save object
instead of title
and then print seperatly
but defining const is not allowed
inside
right?
gadzet
@gadzet
Jul 05 2017 12:31
its my last question
how to define constant inside map function
alpox
@alpox
Jul 05 2017 12:31
@gadzet it is allowed when you are in a function scope, means you'd have to change it to:
const list = items.channels.map(channel => {
    const someConstant = "MY_CONSTANT";
     return( <div><ul>
                <h1>{channel.title}</h1>
            <li>
                {channel.schedules.map(schedule => schedule.title)}
            </li>
            </ul></div>);
});
But anyways, defining a constant would probably be better outside
gadzet
@gadzet
Jul 05 2017 12:33
and then put shcedule object
inside the constant
because this will only print the titles
i might need other info from schedule
btw thanks @alpox
CamperBot
@camperbot
Jul 05 2017 12:33
gadzet sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1213 | @alpox |http://www.freecodecamp.com/alpox
alpox
@alpox
Jul 05 2017 12:33
@gadzet Ah
Well for that you can expand the inner map
Ayush Mahajan
@ay2306
Jul 05 2017 12:33
@gadzet
$(document).ready(function(){
    $('.firstMove_choice_compartment').on('click',function(){
        if(this.id=='computer' && first_move_tmp_boolean){
            first_move_tmp_boolean = false;
            showTheTurn("Computer");
            setTimeout(computer_move(this.id),3000);
            }
            //  $('#resetGame').hide();
        });
    $('#resetGame').on('click',resetGamefunction);

    $('.compartment').on('click',function(){
        if(!isFilled(board,parseInt(this.id[1])) && gameRunning){
        $('#'+this.id).removeClass('compartment');
        $('#'+this.id).html('<center>'+computer.toUpperCase()+'</center>');
        board[number_to_ij(parseInt(this.id[1]))[0]][number_to_ij(parseInt(this.id[1]))[1]] = computer;
        if(evaluate(board)== -10){declareWinner(computer.toUpperCase());}
        if(isMoveLeft(board)){
        showTheTurn("Computer");
        setTimeout(computer_move('compartment'),3000);
        }
        else if(!isMoveLeft(board)){
            declareDraw();
        }

        }
    });
});

function computer_move(a){
    var bestMove = findBestMove(board);
    console.log(bestMove);
    var move = ij_to_number([bestMove.row,bestMove.col]);
    console.log(move);
    $('#_'+move).removeClass('compartment');
    $('#_'+move).html('<center>'+player.toUpperCase()+'</center>');
    board[number_to_ij(parseInt(move))[0]][number_to_ij(parseInt(move))[1]] = player;
    if(evaluate(board)== 10){declareWinner(player.toUpperCase());}
    console.log(board[0] + '   ' + board[1] + '   ' + board[2]);
    if(!isMoveLeft(board)){
    declareDraw();
    }
    if(a=='computer'){
        $('#first_move_choice').hide();
        $('#mainBox').show();
        showTheTurn("Player");
    }
    if(isMoveLeft(board) && gameRunning){
            showTheTurn("Player");            
    }
}
It is not pausing
gadzet
@gadzet
Jul 05 2017 12:34
@alpox what is the approach ?
alpox
@alpox
Jul 05 2017 12:34
But i'd suggest you to eigher put the inner mapping to another component (Rendering the schedule) because otherwise it gets a bit big
gadzet
@gadzet
Jul 05 2017 12:35
@ay2306 look right to me try to console log something inside if(this.id=='computer' && first_move_tmp_boolean){ and see if it gets there
@alpox i will do that, but its my first redux project so i want first to see the data
it is easier for the learning
and then pass the props to the smaller component
but i dont get the syntax
old javascript is ok but this is dark for me
:D
alpox
@alpox
Jul 05 2017 12:36
const Schedule = schedule =>
    <div>
        <h1>schedule.title</h1>
        <div>....</div>
    </div>;

// .... some code here, probably opening a context
const list = items.channels.map(channel =>
    <div>
        <ul>
            <h1>
                {channel.title}
            </h1>
            <li>
                {channel.schedules.map(schedule =>
                    <Schedule schedule={schedule} />,
                )}
            </li>
        </ul>
    </div>,
);
Ayush Mahajan
@ay2306
Jul 05 2017 12:37
@gadzet tried console.log but not working
gadzet
@gadzet
Jul 05 2017 12:37
its not logging anything ? @ay2306
Ayush Mahajan
@ay2306
Jul 05 2017 12:37
it is
alpox
@alpox
Jul 05 2017 12:38
@ay2306 setTimeout(computer_move(this.id),3000); you directly call the function - it won't be called on timeout anymore
As soon as you put () after computer_move its instantly executed and not deferred
Ayush Mahajan
@ay2306
Jul 05 2017 12:39
@alpox ohhh
@alpox what should I do?
alpox
@alpox
Jul 05 2017 12:39

What you can do is either:

setTimeout(() => computer_move(this.id),3000);

Or:

setTimeout(computer_move.bind(null, this.id),3000);
gadzet
@gadzet
Jul 05 2017 12:41
@alpox compiler wont allow me do this
| <Programme schedule={schedule}/>},
Ayush Mahajan
@ay2306
Jul 05 2017 12:41
@alpox its working thanks
CamperBot
@camperbot
Jul 05 2017 12:41
ay2306 sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1214 | @alpox |http://www.freecodecamp.com/alpox
gadzet
@gadzet
Jul 05 2017 12:42
it complains about the slash
curly breacket
sry
alpox
@alpox
Jul 05 2017 12:44
@ay2306 np :-)
@gadzet can you show more code?
gadzet
@gadzet
Jul 05 2017 12:45
sry
typo
:D
alpox
@alpox
Jul 05 2017 12:45
:D okay
stfn1
@stfn1
Jul 05 2017 12:46

Hey could anyone help me with this code ?

$(document).ready(function(){
  // when button is clicked do this : 
  $("#search").click(function(){
    // set variable to user input
    var searchbar = $("#searchbar").val();
    // url for wiki with user input
    var url = "https://en.wikipedia.org/w/api.php?action=opensearch&search="+searchbar+"&format=json&callback=?"; 
  // ajax call  
  $.ajax( {
    url: url,
    dataType: 'jsonp',
    success: dataFunction,
    error: function(error){
             console.log("error");
               }   
     });
 // succes call to display ajax data   
function dataFunction(data) {
  $("#results").append(data[1][0]); 
    };  
  });
});

For some reason its not displaying anything

Stephen James
@sjames1958gm
Jul 05 2017 12:46
@stfn1 Check your developer tools console for errors
stfn1
@stfn1
Jul 05 2017 12:47
@sjames1958gm There aren't any errors there
Sometimes it does show the data there for a second but the page instantly refreshes
korzo
@korzo
Jul 05 2017 12:49
@stfn1 What is #search ? Maybe you should prevent default action
stfn1
@stfn1
Jul 05 2017 12:50
@korzo #search is the ID of the search button
@korzo to submit whatever is typed in the searchbar
Stephen James
@sjames1958gm
Jul 05 2017 12:51
@stfn1 Do you have a form element. If your search button is a submit type then @korzo is correct
korzo
@korzo
Jul 05 2017 12:51
@stfn1 Is button in form? If page refresh, it looks like it's reloaded because of click action
Stephen James
@sjames1958gm
Jul 05 2017 12:51
$("#search").click(function(e){
    e.preventDefaults();
stfn1
@stfn1
Jul 05 2017 12:52
yes the button is in bootstrap form with the bar
korzo
@korzo
Jul 05 2017 12:53
@stfn1 Then modify your code according to @sjames1958gm snippet
stfn1
@stfn1
Jul 05 2017 12:54
@sjames1958gm @korzo thanks, i take it preventDefaults() is a build in jquery method ?
CamperBot
@camperbot
Jul 05 2017 12:54
stfn1 sends brownie points to @sjames1958gm and @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 219 | @korzo |http://www.freecodecamp.com/korzo
:star2: 7992 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 05 2017 12:55
@stfn1 Yes, although it might be preventDefault() I can never remember
stfn1
@stfn1
Jul 05 2017 12:56
Yes thanks alot, fixed the problem
Adri Jenie
@Adrifajar
Jul 05 2017 13:08
how to replace all non alphanumerical in a string?
str.replace(/[^0-9a-zA-Z_]/g,''), could this work?
because i can not replace "_".
mitron6
@mitron6
Jul 05 2017 13:09
@Adrifajar yes
Adri Jenie
@Adrifajar
Jul 05 2017 13:09
i already use str.replace(/[^0-9a-zA-Z_]/g,''). but the underscore somehow can not be removed
mitron6
@mitron6
Jul 05 2017 13:09
@Adrifajar /[^0-9A-Z_]/ig also. i to ignore case.
Adri Jenie
@Adrifajar
Jul 05 2017 13:10
i use str=str.toLowerCase(); to change it to lowercase
im doing the " challenge Check for Palindromes"
mitron6
@mitron6
Jul 05 2017 13:11
@Adrifajar It is just that you don't need both a-z and A-Z if you use the i flag.
Adri Jenie
@Adrifajar
Jul 05 2017 13:12
this is my code

function palindrome(str) {

str=str.toLowerCase();
str= str.split(' ');
str = str.join("");
str=str.replace(/[^0-9a-z_]/g,'');

palin = str.split("");
palin =palin.reverse();
palin =palin.join("");

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

mitron6
@mitron6
Jul 05 2017 13:13
@Adrifajar Is it working?
Adri Jenie
@Adrifajar
Jul 05 2017 13:13
it does all the job except the one with "_"
its working except the input with underscores
mitron6
@mitron6
Jul 05 2017 13:13
@mitron6 You want to replace everything that is NOT _, 0-9, and A-Z?
Ravi Kishore Thella
@ravikishorethella
Jul 05 2017 13:14
@Adrifajar use this regex /[\W_]/g
Adri Jenie
@Adrifajar
Jul 05 2017 13:14
yes. i want all all non-alphanumeric characters
how does it work. i am still confused by regexp thingy
@ravikishorethella thank you
CamperBot
@camperbot
Jul 05 2017 13:16
adrifajar sends brownie points to @ravikishorethella :sparkles: :thumbsup: :sparkles:
:cookie: 910 | @ravikishorethella |http://www.freecodecamp.com/ravikishorethella
mitron6
@mitron6
Jul 05 2017 13:16
@Adrifajar But your code is removing _ because when I test here it does not remove _
Adri Jenie
@Adrifajar
Jul 05 2017 13:16
@mitron6 thank you
CamperBot
@camperbot
Jul 05 2017 13:16
adrifajar sends brownie points to @mitron6 :sparkles: :thumbsup: :sparkles:
:cookie: 761 | @mitron6 |http://www.freecodecamp.com/mitron6
Ravi Kishore Thella
@ravikishorethella
Jul 05 2017 13:16
@Adrifajar :thumbsup:
Adri Jenie
@Adrifajar
Jul 05 2017 13:16
what is this means? [\W_]
mitron6
@mitron6
Jul 05 2017 13:17
@Adrifajar The [\W_] will remove underline. Is that what you want?
Adri Jenie
@Adrifajar
Jul 05 2017 13:19
Matches any non-word character. Equivalent to [^A-Za-z0-9_].
its \W
Stephen James
@sjames1958gm
Jul 05 2017 13:20
@Adrifajar [\W_] adds back in _ to the match as \W does not include _
mitron6
@mitron6
Jul 05 2017 13:23
@Adrifajar Regex can be challenging to learn. It is easier to collect several examples that do what you want and allow yourself to slowly become familiar with the power behind regular expressions.
Jianhao Tan
@jaanhio
Jul 05 2017 13:25

hi all, i am trying to figure out how to set the time interval for each lightup sequence for Simon game.

function playSeq(){
   game.currentGame.forEach(function(x){
     if(x=="yellow"){
        $("#yellow").animate({"background-color": "#FFF40F"}, 40).delay(100).animate({"background-color": "#BDB800"}, 40);
    game.sounds.yellow.play();
     }
     else if(x=="blue"){
       $("#blue").animate({"background-color": "#0ECEF5"}, 40).delay(100).animate({"background-color": "#0B6F9C"}, 40);
    game.sounds.blue.play();
     }
     else if(x=="green"){
        $("#green").animate({"background-color": "#2FFF00"}, 40).delay(100).animate({"background-color": "#20AD00"}, 40);
    game.sounds.green.play();
     }
     else{
      $("#red").animate({"background-color": "#FF1C00"}, 40).delay(100).animate({"background-color": "#9E2400"}, 40);
    game.sounds.red.play();
     }
   });
  }

is there a way i can set it such that after each sequence, theres a delay before the next seq is called?

e.g seq = [red, blue, red];
animate red -> delay 1000ms -> animate blue —> delay 1000ms —> animate red

mitron6
@mitron6
Jul 05 2017 13:34
@jaanhio Maybe you can try https://www.w3schools.com/js/js_timing.asp
John Wilfred
@ewojjowe
Jul 05 2017 13:36
Hi
@stfn1 just parse it using .getJSON() function
Ayush Kumar
@Gr8ayu
Jul 05 2017 13:58
I want to use Images from my pc in my codepen . How can I do that ??
luccifer00
@luccifer00
Jul 05 2017 14:01
hie there! i get trunk on wheather app... i am not sure if the code is right, i was using part of last proyect code, and right now i am not sure how to continue... codepen.io/luccifer00/pen/owdwqG
Stephen James
@sjames1958gm
Jul 05 2017 14:02
@Gr8ayu Probably not, unless your PC has a globally available server?
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:03
@sjames1958gm I want to know about any site which allow me to do such things
Stephen James
@sjames1958gm
Jul 05 2017 14:04
@Gr8ayu Drop box allows you to share images, and you can use their URL in an img tag?
luccifer00
@luccifer00
Jul 05 2017 14:04
i am not sure if i am calling the api, correctly... or how to siplay on the boxes
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:04
@sjames1958gm I want to use them as their file name
Stephen James
@sjames1958gm
Jul 05 2017 14:05
@Gr8ayu codepen cannot, as far as I know do that. You can try with file:/// URL but I am pretty sure that won't work
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:06
@sjames1958gm I am making card game , which pick random cards , I want to display the card which is randomly picked like 10D.jpg for 10 of Diamond .
luccifer00
@luccifer00
Jul 05 2017 14:06
i think i dont have to use forEach, to rescue the data of the DarkSky Api...
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:07
@sjames1958gm I have heard of Imgur , Flickr,500px,Photobucket .... but dont know if they will let me use images as their filename
Stephen James
@sjames1958gm
Jul 05 2017 14:07
@Gr8ayu You would have to find a service that allows you to host the images. I used dropbox
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:08
@sjames1958gm kk thanks
CamperBot
@camperbot
Jul 05 2017 14:08
gr8ayu sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7993 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
luccifer00
@luccifer00
Jul 05 2017 14:11
codepen.io/luccifer00/pen/owdwqG sorry i am not sure if i save the pen. this is my last modifications
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:12
@luccifer00 what problem you are facing ??
HenrikRasmussen
@HenrikRasmussen
Jul 05 2017 14:14
anybody solved "Title Case a Sentence"?
Diego Mayer
@Chrono79
Jul 05 2017 14:15
@HenrikRasmussen yes
HenrikRasmussen
@HenrikRasmussen
Jul 05 2017 14:15
is there an easy way to uppercase first letter?
Diego Mayer
@Chrono79
Jul 05 2017 14:15
depends on what you call easy
but yes
try using a loop and string concatenation
luccifer00
@luccifer00
Jul 05 2017 14:16
@Gr8ayu i am trunk on wheatter app challenge, i have the code pen, if someone can guide me a little bit...
Diego Mayer
@Chrono79
Jul 05 2017 14:16
you can't mutate strings, but you can overwrite array elements @HenrikRasmussen
Jianhao Tan
@jaanhio
Jul 05 2017 14:17

hi all, i am trying to figure out how to set the time interval for each lightup sequence for Simon game.

function playSeq(){
   game.currentGame.forEach(function(x){
     if(x=="yellow"){
        $("#yellow").animate({"background-color": "#FFF40F"}, 40).delay(100).animate({"background-color": "#BDB800"}, 40);
    game.sounds.yellow.play();
     }
     else if(x=="blue"){
       $("#blue").animate({"background-color": "#0ECEF5"}, 40).delay(100).animate({"background-color": "#0B6F9C"}, 40);
    game.sounds.blue.play();
     }
     else if(x=="green"){
        $("#green").animate({"background-color": "#2FFF00"}, 40).delay(100).animate({"background-color": "#20AD00"}, 40);
    game.sounds.green.play();
     }
     else{
      $("#red").animate({"background-color": "#FF1C00"}, 40).delay(100).animate({"background-color": "#9E2400"}, 40);
    game.sounds.red.play();
     }
   });
  }

is there a way i can set it such that after each sequence, theres a delay before the next seq is called?
e.g seq = [red, blue, red];
animate red -> delay 1000ms -> animate blue —> delay 1000ms —> animate red

not sure how i can incorporate setTimeout into the code

Ayush Kumar
@Gr8ayu
Jul 05 2017 14:18
@luccifer00 In weather app , what is the problem ?
HenrikRasmussen
@HenrikRasmussen
Jul 05 2017 14:19
@Chrono79 i used toLower and split - so all i need is get first letter in each word capital and join words again. hmm
Diego Mayer
@Chrono79
Jul 05 2017 14:20
after split, capitalize only the first letter, add the rest of the word using string concatenation and overwrite the whole word
you can use slice, substring or substr to get the rest of the word
luccifer00
@luccifer00
Jul 05 2017 14:22
@Gr8ayu I used the code on previous challenge, and i dont know if it is correctly...
also, i think i make the ajax correct, but i dont know how to get certains properties and his values to write in the boxes..
I you could see the code pen and see the code, could you guide me, to not get trunk please?
HenrikRasmussen
@HenrikRasmussen
Jul 05 2017 14:24
@Chrono79 thanks - seems easy when you write it like that. but in my head seems like i never learned a solution "tool" in prev lessons
CamperBot
@camperbot
Jul 05 2017 14:24
henrikrasmussen sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4457 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jul 05 2017 14:25
@jaanhio check this: https://stackoverflow.com/questions/37370085/change-appearance-of-elements-based-on-sequence-stored-in-array
Note that the way he used, he destroyed the sequence array
luccifer00
@luccifer00
Jul 05 2017 14:26
ah! @Gr8ayu I also need to set the timezone, the DarkSky Api required to me, i only get the latitude and longitude coordinates (from the code of FFC lessons) , i am not sure how to get the timezone....
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:26
@luccifer00 https://darksky.net/dev/docs/forecast see example
luccifer00
@luccifer00
Jul 05 2017 14:29
@Gr8ayu thats the cuestión, how can i set the timezone?
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:30
variable.timezone @luccifer00
Stephen James
@sjames1958gm
Jul 05 2017 14:35
@Gr8ayu The filename becomes part of the URL
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:38
@sjames1958gm can I use like $(...).css(....,"www.xyz.com/image/acc/"+randomName+".jpg") ??
Stephen James
@sjames1958gm
Jul 05 2017 14:38
@Gr8ayu You will nee http:// or https:// but yes
@Gr8ayu Or you can set the src attribute on an img element
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:39
@sjames1958gm which site will let me do that ??
Stephen James
@sjames1958gm
Jul 05 2017 14:40
dropbox will let you share files that are images.
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:41
@sjames1958gm ok thank you
CamperBot
@camperbot
Jul 05 2017 14:41
:warning: gr8ayu already gave sjames1958gm points
gr8ayu sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:41
@luccifer00 see if https://codepen.io/gr8ayu/pen/pwzarG helps ?
Stephen James
@sjames1958gm
Jul 05 2017 14:41
@Gr8ayu Here is where I used one as background
body {
    background-image: url("https://www.dropbox.com/s/y36qz4fel050exx/P0EjYxl-mountain-background-images.jpg?raw=1");

  background-repeat: no-repeat;
  background-size: cover;
}
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:42
@sjames1958gm with which file name you had uploaded the image ?
Stephen James
@sjames1958gm
Jul 05 2017 14:43
P0EjYxl-mountain-background-images.jpg
You have to go to dropbox.com on line and share the file then copy the link (you have to put raw=1 at the end or you get a web page reference)
Ayush Kumar
@Gr8ayu
Jul 05 2017 14:44
@sjames1958gm got it :+1:
GeorgeII
@GeorgeII
Jul 05 2017 14:45
Hello! Can anyone explain me how to get Wiki API callback? I mean what URL should I use? For example this link:
https://en.wikipedia.org/w/api.php?action=query&titles=Wild%20World&prop=revisions&rvprop=content&format=jsonfm
So I can open this link in my browser (that means link exists) but can't get JSON from it
Sweet Coding :)
@SweetCodingInc
Jul 05 2017 14:47
@GeorgeII At the end of your url, you have format=jsonfm, change it to format=json
Moisés Man
@moigithub
Jul 05 2017 14:47
also u need to deal with CORS @GeorgeII
check ur devtools (F12 on most browsers to open it) / console tab IF u get any errors
Miguel Hernandez
@Miguel-HR
Jul 05 2017 14:50
Hello everyone,
I am currently on the "Title Case a Sentence" challenge and think I am on the right track. Could someone check my code?
function titleCase(str) {
  var words = str.split(' ');

  for (var i = 0; i < words.length; i++) {
    if (words[i].length === 0) {
      str = words.toUppercase;

    }
  }
  return str;
}
GeorgeII
@GeorgeII
Jul 05 2017 14:51
@SweetCodingInc I've already tried. So my problem: there's a link that exists, but when I use $.getJSON or $.AJAX with this URL there's no callback
jason.song
@sxj1011
Jul 05 2017 14:51
Vue.component('currency-input', {
  template: '\
    <div>\
      <label v-if="label">{{ label }}</label>\
      $\
      <input\
        ref="input"\
        v-bind:value="value"\
        v-on:input="updateValue($event.target.value)"\
        v-on:focus="selectAll"\
        v-on:blur="formatValue"\
      >\
    </div>\
  ',
Any one can help me
What does the "\" mean?
Sweet Coding :)
@SweetCodingInc
Jul 05 2017 14:51
@GeorgeII Like @moigithub said, you need to handle CORS issue.
Just add &callback=? at the end of your url
and then use $.getJSON
Dan Couper
@DanCouper
Jul 05 2017 14:53
@sxj1011 JS pre-2015 (when template strings were added) can't deal with multiline strings very well. That whole block is a string, so for readability it has been put on different lines, the\ just escapes the newline. It is a bit hacky. If you just used backticks instead of ', then you could get rid of the \ characters
luccifer00
@luccifer00
Jul 05 2017 14:54
@GeorgeII thanks, but you are using other API, and i am not sure how to doit with Dark Sky Api..... i PM to you anywayssss
CamperBot
@camperbot
Jul 05 2017 14:54
luccifer00 sends brownie points to @georgeii :sparkles: :thumbsup: :sparkles:
:cookie: 6 | @georgeii |http://www.freecodecamp.com/georgeii
GeorgeII
@GeorgeII
Jul 05 2017 14:54
@SweetCodingInc @moigithub thanks a lot
CamperBot
@camperbot
Jul 05 2017 14:54
georgeii sends brownie points to @sweetcodinginc and @moigithub :sparkles: :thumbsup: :sparkles:
:cookie: 74 | @sweetcodinginc |http://www.freecodecamp.com/sweetcodinginc
:star2: 3465 | @moigithub |http://www.freecodecamp.com/moigithub
Dan Couper
@DanCouper
Jul 05 2017 14:54
'\
this\
is\
a\
string\
split\
across\
multiple\
lines\
and\
it\
looks\
awful\
and\
it\
is\
very\
easy to forget some of the \ characters and make an error
'
GeorgeII
@GeorgeII
Jul 05 2017 14:55
@luccifer00 ?
Stephen James
@sjames1958gm
Jul 05 2017 14:55
@Miguel-HR Getting there - you don't need to check the length, the split will always have non-zero length.
You need to call the function toUpperCase() - you should work on words[i] -
jason.song
@sxj1011
Jul 05 2017 14:57
@DanCouper Thank you very much for your detailed explaination.
CamperBot
@camperbot
Jul 05 2017 14:57
sxj1011 sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 830 | @dancouper |http://www.freecodecamp.com/dancouper
Diego Mayer
@Chrono79
Jul 05 2017 14:58
@Miguel-HR don't overwrite str like that
HenrikRasmussen
@HenrikRasmussen
Jul 05 2017 14:58
@Chrono79 thank you - got it solved
CamperBot
@camperbot
Jul 05 2017 14:58
:warning: henrikrasmussen already gave chrono79 points
henrikrasmussen sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
Diego Mayer
@Chrono79
Jul 05 2017 14:58
:+1:
Dan Couper
@DanCouper
Jul 05 2017 14:58
Yeah, you should literally be able to replace the ' at the start and end with ` characters and get rid of the \s and it should work fine
jason.song
@sxj1011
Jul 05 2017 15:03
Yeah, Thank you~
luccifer00
@luccifer00
Jul 05 2017 15:06

guys, i am so trunk on how to understand the apis, and use json for query the parameters to display the selected ones i prefer...

At this moment i have two options code...

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("Your Location" + "<br>Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude);

});
}
GET "https://api.darksky.net/forecast/"+ key + position.coords.latitude + "," + position.coords.longitude +
{
  "latitude": position.coords.latitude,
  "longitude": position.coords.longitude,
  "timezone": variable.timezone,
  "currently": {
    "time": 1453402675,
    "summary": "Rain",
    "icon": "rain",
    "nearestStormDistance": 0,
    "precipIntensity": 0.1685,
    "precipIntensityError": 0.0067,
    "precipProbability": 1,

  }
}

following the example request on his website...
Anyway i am getting an Error: Unexpected String, just below position.coords.longitude + (this "+", i tried to change to ";", and to nothing.

the Other code i had was

 /*$(document).ready(function (){
  var latitude="position.coords.latitude";
  var longitude="position.coords.longitude";
    var key= "505024f678c23d1ab8e972627b8249df"


      $.ajax({
            url: "https://api.darksky.net/forecast/"+ key + position.coords.latitude + "," + position.coords.longitude, 
            type: 'GET',
        data: {},
            dataType: 'json',
            success: function(a) { 
            console.log(a);        
        var html="";

            $("#firstCell").html(html); 

        } //closing success
  }); //closing ajax
   }); //closing ready funcion

But in thise case, i used the code what was functional to me in the other challenge (the random quote machine) using AXAJ to GET the Json API..... but, i am not sure of nothing with that.... and also i dont know on how can i make the request, or how to use the properties and input in the websites.....

Really sorry if the question its too long.... i was asking durin the last 3 days with no response.... i hope someoe can guidme a little bit....

sorry @GeorgeII i wanted refer to @Gr8ayu
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:10
@luccifer00 I couldn't understood your problem so I am unable to provide you exact solution
GeorgeII
@GeorgeII
Jul 05 2017 15:15
@luccifer00 I don't know if I understood you right... But you can't get callback?
luccifer00
@luccifer00
Jul 05 2017 15:15
lol @Gr8ayu maybe i don't have a good English, and that it's a problem to explain my problem. But essentially, I Dont know how to get the data from the Dark Sky API.
alpox
@alpox
Jul 05 2017 15:16
@luccifer00 you can try dataType: 'jsonp'
luccifer00
@luccifer00
Jul 05 2017 15:16
@GeorgeII I am not sure if i get or not the callback, because i am not sure if i am doing well the request
GeorgeII
@GeorgeII
Jul 05 2017 15:17
@luccifer00 Try to replace full URL as in the example
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:17
@alpox , @luccifer00 has written wrong codes
@alpox
Miguel Hernandez
@Miguel-HR
Jul 05 2017 15:17
@sjames1958gm Should have done this earlier...
thank you for the input!
CamperBot
@camperbot
Jul 05 2017 15:17
miguel-hr sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7994 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:17
@luccifer00 I have sent you some messages in PM , check them
alpox
@alpox
Jul 05 2017 15:18
@luccifer00 You have to get a grasp of how to deal with asynchronous data. Your position is only available after the callback from the navigator came back - there you have to initiate the call to darksky
Gus
@Guscoder
Jul 05 2017 15:20
Hi anyone, I am stuck on this RegEx problem: Use capture groups in reRegex to match numbers that appear three times in a string each separated by a space.
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:20
@luccifer00 use $(document).ready(....) to write your codes
Gus
@Guscoder
Jul 05 2017 15:22
I tried several things including /(\d+)\s\1/ butI can't seem to figure it out.
alpox
@alpox
Jul 05 2017 15:24
@Guscoder It should be there exactly three times seperated by space so you can copy your (\d+) that its there 3 times
Ross
@rossfaarley
Jul 05 2017 15:25
I can’t get my celcius / fahrenheit to toggle on clicking. Everything else seems to be working, any ideas why? https://codepen.io/rossfarley/full/vZjNmp/
Gus
@Guscoder
Jul 05 2017 15:26
/(\d+)(\d+)(\d+)\s\1/ did not work
alpox
@alpox
Jul 05 2017 15:26
@Guscoder Yes you don't test for spaces i between
luccifer00
@luccifer00
Jul 05 2017 15:26
@alpox i thought my position should be available before the call back... i put that code at the beggining for that.
In my mind. the logic said.
Someone enter in the website.//he allows the permission to give his coordinates// with that coordinates saved in a var lat and var long call the API, to return the properties//
is not like this?
Gus
@Guscoder
Jul 05 2017 15:27
It says 3 times separated by a space...
alpox
@alpox
Jul 05 2017 15:27
@luccifer00 The problem is that asynchronous code doesn't run from top down :-)
@Guscoder yes but you test now for a number with at least 3 positions, and a space after that
@Guscoder But seperated by space means that there should be a space between those numbers
Gus
@Guscoder
Jul 05 2017 15:29
Thanks, I am not sure how to write it I guess.
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:30
alpox
@alpox
Jul 05 2017 15:30
@saifsmailbox98 not for me
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:30
@saifsmailbox98 not for me too
luccifer00
@luccifer00
Jul 05 2017 15:31
ok @alpox i have to read about asynchronus on javascript thanks
CamperBot
@camperbot
Jul 05 2017 15:31
luccifer00 sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1216 | @alpox |http://www.freecodecamp.com/alpox
SaiChand Duppala
@saichandd
Jul 05 2017 15:31
@saifsmailbox98 down for me
alpox
@alpox
Jul 05 2017 15:32
probably only down in an area
SaiChand Duppala
@saichandd
Jul 05 2017 15:32
yeah, India
shivam gupta
@shivamg11000
Jul 05 2017 15:33
@imRadioactive nope for me , INdia
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:33
Okay.
Thanks @shivamg11000 @imRadioactive @alpox @Gr8ayu
CamperBot
@camperbot
Jul 05 2017 15:33
saifsmailbox98 sends brownie points to @shivamg11000 and @imradioactive and @alpox and @gr8ayu :sparkles: :thumbsup: :sparkles:
:cookie: 302 | @imradioactive |http://www.freecodecamp.com/imradioactive
:cookie: 330 | @gr8ayu |http://www.freecodecamp.com/gr8ayu
:cookie: 359 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
SaiChand Duppala
@saichandd
Jul 05 2017 15:33
hotspot? @shivamg11000
CamperBot
@camperbot
Jul 05 2017 15:33
:star2: 1217 | @alpox |http://www.freecodecamp.com/alpox
shivam gupta
@shivamg11000
Jul 05 2017 15:34
@imRadioactive wifi
SaiChand Duppala
@saichandd
Jul 05 2017 15:34
no, sorry i meant VPN
shivam gupta
@shivamg11000
Jul 05 2017 15:34
nope
@imRadioactive you are from iith
SaiChand Duppala
@saichandd
Jul 05 2017 15:35
yeah
shivam gupta
@shivamg11000
Jul 05 2017 15:35
great
SaiChand Duppala
@saichandd
Jul 05 2017 15:36
:smile: thanks @shivamg11000
CamperBot
@camperbot
Jul 05 2017 15:36
imradioactive sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
:cookie: 360 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
Christopher McCormack
@cmccormack
Jul 05 2017 15:36
:wave:
Jason Luboff
@JLuboff
Jul 05 2017 15:36
:wave:
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:36
@cmccormack @JLuboff hi guys
shivam gupta
@shivamg11000
Jul 05 2017 15:36
:wave: :clap:
Christopher McCormack
@cmccormack
Jul 05 2017 15:37
hi :)
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:39
@imRadioactive where is iith ??
shivam gupta
@shivamg11000
Jul 05 2017 15:39
@Gr8ayu Indian Institue of tech Hyderabad
SaiChand Duppala
@saichandd
Jul 05 2017 15:40
@Gr8ayu its super far from the city
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:41
Can anyone tell me how to use github ?? I have 0 repo
shivam gupta
@shivamg11000
Jul 05 2017 15:42
@Gr8ayu you have any project made
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:42
@Gr8ayu search for github guides :arrow_down:
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:42
@shivamg11000 on my PC I have mede several webpages
Christopher McCormack
@cmccormack
Jul 05 2017 15:42
@Gr8ayu I used this - http://rogerdudler.github.io/git-guide/ but you can ask here for help as well if you like
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:43
@cmccormack that looks cool
Christopher McCormack
@cmccormack
Jul 05 2017 15:44
yeah nice and clean, if not too in depth
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:44
@cmccormack @imRadioactive Thanks
CamperBot
@camperbot
Jul 05 2017 15:44
gr8ayu sends brownie points to @cmccormack and @imradioactive :sparkles: :thumbsup: :sparkles:
:cookie: 303 | @imradioactive |http://www.freecodecamp.com/imradioactive
:cookie: 992 | @cmccormack |http://www.freecodecamp.com/cmccormack
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:45
@cmccormack @imRadioactive Do I need some more knowledge than HTML , CSS & JS to work with github ?
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:46
@Gr8ayu Only if you are working with HTML , CSS & JS files.
Christopher McCormack
@cmccormack
Jul 05 2017 15:46
@Gr8ayu no github is just a repository for your projects
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:47
@cmccormack It will hold all my file on its server ??
SaiChand Duppala
@saichandd
Jul 05 2017 15:47
@Gr8ayu github is repository, you just store the projects, people can check them out
:point_up: July 5, 2017 9:17 PM yes
Christopher McCormack
@cmccormack
Jul 05 2017 15:47
@Gr8ayu you create a repo, clone it to your computer/c9/whatever, add files to your repo, commit changes to those files, then push them up to the remote. git is the underlying version control system, and github is basically a remote storage location for your repos
shivam gupta
@shivamg11000
Jul 05 2017 15:48
@Gr8ayu use linux for git
Christopher McCormack
@cmccormack
Jul 05 2017 15:48
I use git across windows/mac/linux, don't limit yourself :) @shivamg11000
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:49
@cmccormack @imRadioactive @shivamg11000 Is it complicated thing or I am stupid ?
shivam gupta
@shivamg11000
Jul 05 2017 15:49
@cmccormack window is waste of time
@Gr8ayu just read the tutorial
its easy
SaiChand Duppala
@saichandd
Jul 05 2017 15:49
at first it seems like a big thing, just use it and u'll be good to go
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:49
@shivamg11000 @cmccormack @imRadioactive ok thank u
CamperBot
@camperbot
Jul 05 2017 15:49
gr8ayu sends brownie points to @shivamg11000 and @cmccormack and @imradioactive :sparkles: :thumbsup: :sparkles:
:warning: gr8ayu already gave imradioactive points
:warning: gr8ayu already gave cmccormack points
:cookie: 361 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
Christopher McCormack
@cmccormack
Jul 05 2017 15:49
@Gr8ayu nope not too complicated. may seem like it at first but once you get the hang of it, it gets pretty simple
@Gr8ayu every error/issue you can imagine has already been asked online so when in doubt search :)
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:51
@imRadioactive I'll eat ur brain in private chat (just becuz u are from IIT), is that ok ??
Christopher McCormack
@cmccormack
Jul 05 2017 15:51
@Gr8ayu best way to really learn it is to try and use it
Ayush Kumar
@Gr8ayu
Jul 05 2017 15:52
@cmccormack Do I need to download something ??
SaiChand Duppala
@saichandd
Jul 05 2017 15:52
@Gr8ayu lol, its fine, i started 3 months ago, the people here are awesome
shivam gupta
@shivamg11000
Jul 05 2017 15:52
@imRadioactive you need to install git
Christopher McCormack
@cmccormack
Jul 05 2017 15:52
@Gr8ayu yes you'll need a versioning application like git
SaiChand Duppala
@saichandd
Jul 05 2017 15:53
@shivamg11000 How did u know I dont use git :smiley:
shivam gupta
@shivamg11000
Jul 05 2017 15:53
@imRadioactive I was saying to @Gr8ayu
SaiChand Duppala
@saichandd
Jul 05 2017 15:53
I know, just kidding :smile:
Aniculaesei
@Aniculaesei
Jul 05 2017 15:55
Hi guys!I am at ROMAN NUMERAL CONVERSION!Can you tell me please,from where this Array? [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ];Thank you
Stephen James
@sjames1958gm
Jul 05 2017 15:56
@Aniculaesei Those are the values of M, XM, D, CD, C, XC, L, XL, X, IX, V, IV, I
Christopher McCormack
@cmccormack
Jul 05 2017 15:56
@Aniculaesei I think it's just a convenience array that was created to cover all scenarios. The other numbers can be filled in logically but some aren't so logical
Stephen James
@sjames1958gm
Jul 05 2017 15:57
@Aniculaesei You can use data structures like these to drive the algorithm
Christopher McCormack
@cmccormack
Jul 05 2017 15:57
@sjames1958gm :wave: doing presidents now or just for the holiday? :D
Stephen James
@sjames1958gm
Jul 05 2017 15:57
@cmccormack For the holiday.
Christopher McCormack
@cmccormack
Jul 05 2017 15:57
:fireworks: :fireworks: :fireworks: :fireworks: :fireworks:
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:58
This message was deleted
Jianhao Tan
@jaanhio
Jul 05 2017 15:58
@Chrono79 thank you! i will check it out. still kinda confusing to me
CamperBot
@camperbot
Jul 05 2017 15:58
jaanhio sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4458 | @chrono79 |http://www.freecodecamp.com/chrono79
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 15:58
@Aniculaesei
image.png
Aniculaesei
@Aniculaesei
Jul 05 2017 15:59
@cmccormack ok..but why theese and why don't we choose others?1
5
10
50
100
500
1000
For example!!
Ayush Kumar
@Gr8ayu
Jul 05 2017 16:01
@Aniculaesei you need to ask romans
Christopher McCormack
@cmccormack
Jul 05 2017 16:01
@Aniculaesei not sure what you mean - those are in your array. The array contains the major numeral (I, V, X, etc...) as well as the numeral minus the value (IV, IX, XL, etc...) because these latter values aren't very programmatic
Saif Ur Rahman
@saifsmailbox98
Jul 05 2017 16:01
@Aniculaesei I would suggest checking out the trend/pattern of roman numerals
http://literacy.kent.edu/Minigrants/Cinci/romanchart.htm
Jianhao Tan
@jaanhio
Jul 05 2017 16:01
@Chrono79 what does the brackets around position mean?
let blink = (position) => {
  document.getElementById(position).style.opacity = 0.5;
};
Christopher McCormack
@cmccormack
Jul 05 2017 16:02
@jaanhio those are parenthesis and they are used around multiple parameters, you don't need them around a single parameter in ES6 though
@jaanhio that can be read as function blink(position){ ... }
Jianhao Tan
@jaanhio
Jul 05 2017 16:03
@cmccormack ah i see! its equivalent to saying
function(position){
Christopher McCormack
@cmccormack
Jul 05 2017 16:03
@jaanhio right
Jianhao Tan
@jaanhio
Jul 05 2017 16:03
thank you @cmccormack !
CamperBot
@camperbot
Jul 05 2017 16:03
jaanhio sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:cookie: 993 | @cmccormack |http://www.freecodecamp.com/cmccormack
Aniculaesei
@Aniculaesei
Jul 05 2017 16:08
@saifsmailbox98 thank you
CamperBot
@camperbot
Jul 05 2017 16:08
aniculaesei sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 712 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Aniculaesei
@Aniculaesei
Jul 05 2017 16:08
@cmccormack thank you
CamperBot
@camperbot
Jul 05 2017 16:09
aniculaesei sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:cookie: 994 | @cmccormack |http://www.freecodecamp.com/cmccormack
Aniculaesei
@Aniculaesei
Jul 05 2017 16:09
@Gr8ayu thank you
CamperBot
@camperbot
Jul 05 2017 16:09
aniculaesei sends brownie points to @gr8ayu :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @gr8ayu |http://www.freecodecamp.com/gr8ayu
Christopher McCormack
@cmccormack
Jul 05 2017 16:10
@jaanhi if you have some free time check out the FCC beta on ES6 - http://beta.freecodecamp.com/en/challenges/es6/introduction-to-the-es6-challenges
Aniculaesei
@Aniculaesei
Jul 05 2017 16:10
@cmccormack My question was ,why: [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1} and not [4,6,4,2,233,4444,777,88888 :)]
Christopher McCormack
@cmccormack
Jul 05 2017 16:10
@Aniculaesei oh sorry haha
Aniculaesei
@Aniculaesei
Jul 05 2017 16:11
@cmccormack what is the difference with BETA version?Thank you
Christopher McCormack
@cmccormack
Jul 05 2017 16:12
@Aniculaesei Has a lot more material but they're probably still working out bugs with the site/curriculum
Aniculaesei
@Aniculaesei
Jul 05 2017 16:13
@cmccormack I have to start it from begining again?