These are chat archives for FreeCodeCamp/Help

18th
Jan 2018
Claudio Restifo
@Marmiz
Jan 18 2018 03:51

Guys, anyone here know a short syntax notation to initialize multiple variables all with the same values?
ie:

let a = 1
let b = 1
[..ecc..ecc]

thanks

ehutchllew
@ehutchllew
Jan 18 2018 03:52
@Marmiz if I'm not mistaken you can do let a, b, c = 1
Kyle Holm
@thekholm80
Jan 18 2018 03:52
nope
just tried that lol
let a, b, c = 1;

console.log(b) // undefined
ehutchllew
@ehutchllew
Jan 18 2018 03:52
hmm
Kyle Holm
@thekholm80
Jan 18 2018 03:54
apparently you can do let a = b = c = 1;
ehutchllew
@ehutchllew
Jan 18 2018 03:54
@thekholm80 could try { a, b, c } = this
if you're using classes
Kyle Holm
@thekholm80
Jan 18 2018 03:57
let [a, b, c] = Array(3).fill(1); this worked
Claudio Restifo
@Marmiz
Jan 18 2018 04:35

mmmh, they might work but are not as expressive.. since it's an initialization I want it to be clear to anyone looking at the code.
But thanks guys.

btw @thekholm80 don't this let a = b = c = 1; have variable leaking?
or JS takes care of that? (I doubt)

CamperBot
@camperbot
Jan 18 2018 04:35
marmiz sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1668 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Claudio Restifo
@Marmiz
Jan 18 2018 04:35
@ehutchllew thanks :sparkles:
Kyle Holm
@thekholm80
Jan 18 2018 04:35
@Marmiz oh no, let a = b = c = 1; is horrible and should never be used. the scope issues ...
however, it works lol
Claudio Restifo
@Marmiz
Jan 18 2018 04:36
so you have variable leaking :)
Kyle Holm
@thekholm80
Jan 18 2018 04:37
I'm not familiar with that term, but it sounds like something to fear
Claudio Restifo
@Marmiz
Jan 18 2018 04:39
I think that, since you are chaining them but the first one is not declared yet; they'll fell out of scope and picked up by the global window object (I thnik that's how JS interpreter will read them).
Kyle Holm
@thekholm80
Jan 18 2018 04:41
@Marmiz from what I've read they become global variables and your explanation makes sense
Claudio Restifo
@Marmiz
Jan 18 2018 05:19
psa: I discovered that in JSX i can use spread with ternary to chose which object to spread as:
{...(condition ? case1 : case2)}
Kaz Baig
@kbaig
Jan 18 2018 05:47
that's just plain ol javascript
Sweet Coding :)
@SweetCodingInc
Jan 18 2018 05:48
@Marmiz Not just jsx though
Kaz Baig
@kbaig
Jan 18 2018 06:31

Interesting JS snippet making the rounds:

const a = {};
a.abuseCoercion = 0;
a.valueOf = function() {
  this.abuseCoercion++;
  return this.abuseCoercion;
}

console.log(a == 1 && a == 2 && a == 3); // true

It was from an interview question asking, "Can (a == 1 && a == 2 && a == 3) ever evaluate to true?"

Muhammed Hafiz
@zifahm
Jan 18 2018 06:35
got true as output in console
Claudio Restifo
@Marmiz
Jan 18 2018 06:38
yeh but for whatever reason never thought I could actually use it in JSX. Mental barrier i guess
Happy-Ferret
@Happy-Ferret
Jan 18 2018 07:59

@SweetCodingInc I guess I should've used a slightly different terminology.
When I said "pull" I meant "pick". Like in git cherry-pick.

I've found this little snippet. Have yet to try it, but it seems to do what I want (albeit based on changes in a directory directory rather than a singular filename).

git cherry-pick $(git log --format=oneline --no-merges featureA...master tools/my-tool | tail -r | cut -d " " -f 1)

Eric Miller
@ericmiller777
Jan 18 2018 12:35
Hey guys been a while, anyone up?
ArmaModus
@ArmaModus
Jan 18 2018 13:18
hi anyone there?
Stephen James
@sjames1958gm
Jan 18 2018 13:26
Yes
ArmaModus
@ArmaModus
Jan 18 2018 13:30
hi, i have just begun programming and i wanted to know is it possible to create a program that can use other programs installed on the computer, example if i ask my program hows the day it looks at a weather forecasting website and tells me how the day will be, and if it is possible can it be done in just java or do i need other languages and programs?
Bjorn van de Peut
@bjorno43
Jan 18 2018 13:32
@ArmaModus What you're asking is possible, yes. And sure, it could be done in Java. But something like that isn't so easy to make. It's surely not something to be taken on by a beginner
Gersho
@Gersho
Jan 18 2018 13:34
@ericmiller777 hey ! been ages !
hello /help!
ArmaModus
@ArmaModus
Jan 18 2018 13:34
thank you, i understand it may be too advanced but i wanted to be sure before i get too deep, as long as it is a possibility then ill keep with it
Bjorn van de Peut
@bjorno43
Jan 18 2018 13:34
@Gersho :wave:
ArmaModus
@ArmaModus
Jan 18 2018 13:35
so how does it work? can i make it do so with any program or do i have to create one for it to use?
Gersho
@Gersho
Jan 18 2018 13:35
your explaination is mentioning a weather forecast site, not an application on your computer
ArmaModus
@ArmaModus
Jan 18 2018 13:37
yes but that's an example made under the assumption it is possible for me to open chrome and search an appropriate url to get the information with word associations that the program will make from my input
Gersho
@Gersho
Jan 18 2018 13:39
using another site is easier than using something installed on the user's computer (also it would need specifics rights from the user, people don't like that usually)
ArmaModus
@ArmaModus
Jan 18 2018 13:39
i see
Gersho
@Gersho
Jan 18 2018 13:39
since we're talking weather, have you taken a look at the weather API challenge on freeCodeCamp ?
API is the thing you're looking for
ArmaModus
@ArmaModus
Jan 18 2018 13:41
ok so once again im completely new to this so please correct me if im wrong
the API cant actually edit anything yes, what if i want this program to not only open a said program but also perform tasks with it? Lets say i ask the program to open word and copy paste something from a web page i have recently seen is it possible for an API to do that?
Gersho
@Gersho
Jan 18 2018 13:43
wouldn't that be a huge security issue ? like i visit your site and you do whatever you want on my computer ?
ArmaModus
@ArmaModus
Jan 18 2018 13:44
no not your computer
Bjorn van de Peut
@bjorno43
Jan 18 2018 13:44
What you're talking about is generaly called "website scraping". This can be done both with programs running on a computer or server side scripts like PHP or NodeJS. In your first question you were talking about a program that can use other programs on the computer. That can't be done with languages used for webdevelopment because they don't have access to your hard drive (and for good reason)
Gersho
@Gersho
Jan 18 2018 13:44
you could, however, have your site create the file with the content you want, and allow the user to download it (so in the end, he has his document with the info inside)
i know you can run an application on the computer from the browser (some online games work like that) but i don't know the details (that was on silverlight)
ArmaModus
@ArmaModus
Jan 18 2018 13:45
@bjorno43 what language do i need to learn if i want to make a program that runs other programs?
@Gersho i didnt mean modifying your computer i mean in an instance where i need a article copied i can instruct my program to copy it and it will open the article and copy
to my computer
just as i would if i went and copy pasted it to word by myself
Bjorn van de Peut
@bjorno43
Jan 18 2018 13:48
@ArmaModus Any program that can be compiled and run on the operating system level. So it could be Java, C, C++, C#, Python, VB.NET.. the list is rly too long to name them all
inder23
@inder23
Jan 18 2018 13:48
hi, I am having some trouble with beta.freecodecamp.org challenges
Gersho
@Gersho
Jan 18 2018 13:48
hmm, maybe with an addon then ? like you select some text, right clic "copy to whatever" ?
inder23
@inder23
Jan 18 2018 13:49
when I click on the 'I'v completed this challenge' button nothing seems to happen
ArmaModus
@ArmaModus
Jan 18 2018 13:50
@bjorno43 thats what i have been looking for thank you very much, another issue in my theory for this project is input, can i use vocal input? and if im using java can i use it in co-ordination with another program to convert my speech to text?
CamperBot
@camperbot
Jan 18 2018 13:50
armamodus sends brownie points to @bjorno43 :sparkles: :thumbsup: :sparkles:
:cookie: 198 | @bjorno43 |http://www.freecodecamp.org/bjorno43
Gersho
@Gersho
Jan 18 2018 13:51
@ArmaModus start slow, add that kind of stuff later when you get the first part working
ArmaModus
@ArmaModus
Jan 18 2018 13:51
@Gersho thanks ill take your advice, my problem was i started learning to make this project without knowing if its possible or not so i needed some help
CamperBot
@camperbot
Jan 18 2018 13:51
armamodus sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 589 | @gersho |http://www.freecodecamp.org/gersho
ArmaModus
@ArmaModus
Jan 18 2018 13:54
@bjorno43 @Gersho Thank you very much for your help, one last thing, you know what i want to basically program is there any book or site i can use to help speed this process along?
Bjorn van de Peut
@bjorno43
Jan 18 2018 13:54
@ArmaModus Whoah, one step at a time there! Speech recognition is whole new level. Keep in mind that you can't dive into the ocean without getting your swimming certificates first. You'll simply drown
There are no books that speed up the process of learning. It's up to you on how fast you'll be able to learn and understand what you're doing. As we already told you, one step at a time. First decide on which language you want to learn. Then find a suitable book that's aimed at beginners
Gersho
@Gersho
Jan 18 2018 13:57
if you know of some project that has similar purpose, try looking at what they used
ArmaModus
@ArmaModus
Jan 18 2018 13:58
@bjorno43 Thanks ill take your advice prof ill finish my beginners course first and will come back for advice very soon
CamperBot
@camperbot
Jan 18 2018 13:58
armamodus sends brownie points to @bjorno43 :sparkles: :thumbsup: :sparkles:
api offline
Bjorn van de Peut
@bjorno43
Jan 18 2018 14:00
Weird. Some user opened up a private chat with me like 30 mins ago, but never said anything. When I asked why, no response
ArmaModus
@ArmaModus
Jan 18 2018 14:00
ok i need to learn that how do i open up private chat?
im busy making a new room just so i can get some advice...or is that private?
Naris R
@KittenHero
Jan 18 2018 14:01
for gitter?
ArmaModus
@ArmaModus
Jan 18 2018 14:01
yup
Bjorn van de Peut
@bjorno43
Jan 18 2018 14:01
You can hover a username in the chat. Then click "Chat privately"
Naris R
@KittenHero
Jan 18 2018 14:02
*icon
ArmaModus
@ArmaModus
Jan 18 2018 14:02
thanks just found it
Kyle Holm
@thekholm80
Jan 18 2018 15:07
good morning help room
Gersho
@Gersho
Jan 18 2018 15:08
:wave:
Darren
@DarrenfJ
Jan 18 2018 16:16
morning morning back atcha!
(or evening, night, graveyard shift, as the case may be.. worldwide codingRoomies)
Gersho
@Gersho
Jan 18 2018 16:28
dogwhatch shift, thankfully it's over today
Stephen James
@sjames1958gm
Jan 18 2018 16:33
@DarrenfJ :wave:
Kyle Holm
@thekholm80
Jan 18 2018 16:40
@Gersho so, are you homeless now? going back to France?
Ken Haduch
@khaduch
Jan 18 2018 16:41
@DarrenfJ - Howdy! How are things going?
And hello to @thekholm80 , too... and @Gersho and @sjames1958gm and everyone in the room...
Stephen James
@sjames1958gm
Jan 18 2018 16:42
@khaduch :wave:
Kyle Holm
@thekholm80
Jan 18 2018 16:42
@khaduch good morning Ken
Gersho
@Gersho
Jan 18 2018 16:47

@Gersho so, are you homeless now? going back to France?

lol no not yet, going back home without any dogs ! (and actual internet)

Darren
@DarrenfJ
Jan 18 2018 17:30
things are ok... he company I work got is getting merged with two other companies.. and we met the new suits yesterday
the new CEO has some dream of merging blockchain with eHR..so that should be fun
at least I'll get a front row seat to the madness ;)
Kaz Baig
@kbaig
Jan 18 2018 17:31
@DarrenfJ tbh that's an interesting frontier
Sweet Coding :)
@SweetCodingInc
Jan 18 2018 17:31
@DarrenfJ Ser Darren :wave:
Kaz Baig
@kbaig
Jan 18 2018 17:32
I've been trying to understand the underlying tech since my company is building some tools for blockchain but we don't have any business person who knows about it
Darren
@DarrenfJ
Jan 18 2018 17:34
they still seem like they're in the 'lots of funding available' mode of thinking.. but I've read that you can use blockchain for any kind of tracking/interchange/ledger system that would normally require a third party to do the tracking..
will have to read more to figure out how that would integrate with all the fun concerns of sharing health information online and all the PHI concerns
I've been in IT but in one of those PM, BA QA, training type roles forever so one foot in the tech and two in the business/operations...
we.shall.see
on that note.. off to go explore..
DarrenfJ @DarrenfJ sneaks off to learn more about blockchain
Kaz Baig
@kbaig
Jan 18 2018 17:37
@DarrenfJ An important question to ask in the context of blockchain for ehr is what is the benefit of decentralization here?
Blockchain implementations can have interesting crypto, but you don't opt into it for the crypto
Gersho
@Gersho
Jan 18 2018 17:44
everytime i see blockchain in a explaination i smell something fishy (not saying they all are, but way too many are trying to ride the buzzword wave)
Kaz Baig
@kbaig
Jan 18 2018 17:48
Well we live in a world where a company can add the word blockchain to its name and see its stock go up 400% in a couple days
So there's bound to be some buzzwordiness, but also some legitimacy
Just like the dot com bubble and subsequent crash, there will be a lot of people riding the blockchain wave, providing no value to the market and go bust. We will get genuinely useful businesses out of the ashes
Darren
@DarrenfJ
Jan 18 2018 18:51
from the school of kinda cool and completely ridiculous :D : https://www.atlasobscura.com/places/encryption-lava-lamps
Gersho
@Gersho
Jan 18 2018 18:52
completely ridiculous indeed
Darren
@DarrenfJ
Jan 18 2018 18:52
@kbaig yah, that's kind of the question I need to explore - 'what is the benefit of decentralization here?'
Gersho
@Gersho
Jan 18 2018 18:52
slap a laser pointer on a cat's head, use his movement as your rng basis
Darren
@DarrenfJ
Jan 18 2018 18:53
@Gersho probably pretty random!
Gersho
@Gersho
Jan 18 2018 18:53
and cheaper, you can also upload to youtube for some youtube money
Darren
@DarrenfJ
Jan 18 2018 18:53
although @Manish-Giri sent me or posted a vid of a cat with a go pro walking around and for something like 6 minutes it just watched one thing...
but with the laser pointer it might go wild
Gersho
@Gersho
Jan 18 2018 18:54
oh, they do that as collar now, that tweet a picture every 20 sec
(i can't wait for the cat to intrude in something....private iykwim)
Darren
@DarrenfJ
Jan 18 2018 18:55
ha!
ok, back to work :/
DarrenfJ @DarrenfJ bah's at the inevitability of it all
Gersho
@Gersho
Jan 18 2018 18:56

@kbaig yah, that's kind of the question I need to explore - 'what is the benefit of decentralization here?'

well for starters you're not paying the servers, since every user takes care of it

like the cheap hotels where there's no service
Gersho
@Gersho
Jan 18 2018 19:06
time to pack the computer, i'm off ! later
Giagnus64
@Giagnus64
Jan 18 2018 21:04
Hey all! I seem to be running into a problem on a coding challenge - No matter what I change the code to on the right side/codeeditor, the console on the left outputs the same thing: https://www.freecodecamp.org/challenges/record-collection.
Tried refreshing and clearing cache and nothing seems to be helping.
Screen Shot 2018-01-18 at 4.05.25 PM.png
Aditya
@ezioda004
Jan 18 2018 21:15
@Giagnus64 That does appear to be a problem, I believe function had return collection initially so its returning that. You'll have to use console.log for debugging
Giagnus64
@Giagnus64
Jan 18 2018 21:19
Thanks for responding! I tried that but it seems that nothing I type in the code editor is changing the console on the left side...
I even deleted the entire 'collection' object and nothing changed lol
Screen Shot 2018-01-18 at 4.21.00 PM.png
Aditya
@ezioda004
Jan 18 2018 21:24
Yeah, console on the left side does show the changes you made in the collection object if you pass the tests correctly.
Manish Giri
@Manish-Giri
Jan 18 2018 21:51
@Giagnus64 don't rely too much on the console on the left, use your browser console, or other sites like jsbin, repl.it, etc
@diomed :wave:
Kyle Holm
@thekholm80
Jan 18 2018 21:51
@Manish-Giri :wave:
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:51
hi @Manish-Giri :cat:
Manish Giri
@Manish-Giri
Jan 18 2018 21:51
@thekholm80 :wave:
@thekholm80 I got the java book I was looking at in amazon that day
Kyle Holm
@thekholm80
Jan 18 2018 21:52
@Manish-Giri did you pay $1,000,000?
Manish Giri
@Manish-Giri
Jan 18 2018 21:52
from my uni library
:fu: $153
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:52
he paid 3 fidy
Kyle Holm
@thekholm80
Jan 18 2018 21:53
they have to make what they can, because the book is outdated before it ever gets printed lol
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:53
stealing from uni library is great way to save some money
Manish Giri
@Manish-Giri
Jan 18 2018 21:53
:+1:
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:54
tech books are outdated when they are translated into Croatian
Manish Giri
@Manish-Giri
Jan 18 2018 21:54
@diomed @thekholm80 did you finish wes bos's new grid course already
Kyle Holm
@thekholm80
Jan 18 2018 21:54
I don't do wes bos stuff
Giselle10
@Giselle10
Jan 18 2018 21:54
<a href="#"><img src="https://bit.ly/fcc-running-cats" alt="Three kittens running towards the camera. "></a>
Manish Giri
@Manish-Giri
Jan 18 2018 21:54
for a change, it's free
Giselle10
@Giselle10
Jan 18 2018 21:55
Nest the existing img element within an a element
need help):
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:55
and I was just about to link you to it @Manish-Giri :yum:
Manish Giri
@Manish-Giri
Jan 18 2018 21:55
:yum:
Giselle10
@Giselle10
Jan 18 2018 21:55
thank you guys!!!
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:55
  • outdated I tell you
@Giselle10 u sure u're using proper link?
method looks good
syntax, that is. smh
Manish Giri
@Manish-Giri
Jan 18 2018 21:57
lol
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:57
I think there's a question of dot maybe :|
@Manish-Giri pls make me C# program with python
Giselle10
@Giselle10
Jan 18 2018 21:58
Im not sure ):
Manish Giri
@Manish-Giri
Jan 18 2018 21:58
:/
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:58
u never did send me compiled SE
:sob:
Manish Giri
@Manish-Giri
Jan 18 2018 21:59
um
compiled SE?
May Kittens Devour Your Soul
@diomed
Jan 18 2018 21:59
Subtitle Edit
Manish Giri
@Manish-Giri
Jan 18 2018 21:59
lol wut
I don't remember anything
of subtitle edit
May Kittens Devour Your Soul
@diomed
Jan 18 2018 22:00
sigh u forgot
never mind
you never did come to Croatia @ all in the end, did u?
Manish Giri
@Manish-Giri
Jan 18 2018 22:04
Lol
I didn’t
But I will
Rachel Riley
@ParadiseArtist
Jan 18 2018 22:04
Hello all anyone feel like telling me what I’m doing wrong on with the weather api project?
Manish Giri
@Manish-Giri
Jan 18 2018 22:04
New timeline says May 2018
May Kittens Devour Your Soul
@diomed
Jan 18 2018 22:04
lol
Manish Giri
@Manish-Giri
Jan 18 2018 22:04
@diomed
May Kittens Devour Your Soul
@diomed
Jan 18 2018 22:04
that's delayed by a year now
Manish Giri
@Manish-Giri
Jan 18 2018 22:05
Yea
Blame by advisor
May Kittens Devour Your Soul
@diomed
Jan 18 2018 22:05
@ParadiseArtist just ask. Manish shall help
I have a feeling that guy isn't very good advisor
Rachel Riley
@ParadiseArtist
Jan 18 2018 22:08
$(function(){

  var api = "https://fcc-weather-api.glitch.me/api/current?"
  var lat;
  var lon;

  if(navigator.geolocation){
    navigator.geolocation.getCurrentPosition(function(position) {
      lat = position.coords.latitude;
      lon = position.coords.longitude;
      $("#data").html("latitude: " + lat + "<br>longitude: " + lon);
      getWeather(lat, lon);
    });
  }

  function getWeather(lat, lon) {
    var urlString = api+lat+'&'+lon;
    $.ajax({
      url: urlString ,
      success: function(result){
        console.log(result)
      },
      error: function(error){
        console.log(error)
      }
    })
  }

});
right now I’m just trying to get the ajax call to show me the results anywhere but hopefully in the console.
lol then I’ll worry about using the results but it just keeps giving me the lat as numbers/floats error
Rachel Riley
@ParadiseArtist
Jan 18 2018 22:19
Ok I’m gonna go try a different room if someone feels like they can help be sure to mention @paradiseartist and I’ll come back.
Aditya
@ezioda004
Jan 18 2018 22:22
@ParadiseArtist You're missing string lat and lon from the request in line var urlString = api+lat+'&'+lon;
var urlString = api+'lat='+ lat+'&lon='+lon; this should work.
Rachel Riley
@ParadiseArtist
Jan 18 2018 22:23
lol @ezioda004 thats what I get for rewriting it all day.
I’ll try that and see what happens Thanks!! @ezioda004
CamperBot
@camperbot
Jan 18 2018 22:23
paradiseartist sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 398 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Kaz Baig
@kbaig
Jan 18 2018 22:23
@ParadiseArtist var urlString = api + 'lat=' + lat + '&' + 'lon=' + lon;
o you got it
lol
Kyle Holm
@thekholm80
Jan 18 2018 22:24
@kbaig so slow
Kaz Baig
@kbaig
Jan 18 2018 22:24
I tried it in a pen, it worked
Aditya
@ezioda004
Jan 18 2018 22:24
Took cookie from @kbaig FeelsGoodMan
artbohr
@artbohr
Jan 18 2018 22:25
guys, new quest: Why does dns.lookup doesn't work for URIs such as https://www.google.com works for any other were there is no https://
Rachel Riley
@ParadiseArtist
Jan 18 2018 22:25
Argh! lol it worked I swear I had that in there five different ways before. lol Thanks @kbaig better late than never. Brownies foryou too!
CamperBot
@camperbot
Jan 18 2018 22:25
paradiseartist sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 537 | @kbaig |http://www.freecodecamp.org/kbaig
artbohr
@artbohr
Jan 18 2018 22:26
so it works for www.google.com, google.com but not when you include https://
```dns.lookup(req.body.url, function (err, address, family) {
!err ? res.send(req.body.url) : res.send("wrong domain");
});
Mithu Kurian
@mithukurian
Jan 18 2018 22:27
Hi there
artbohr
@artbohr
Jan 18 2018 22:27
dns.lookup(req.body.url, function (err, address, family) {
    !err ? res.send(req.body.url) : res.send("wrong domain");
  });
returns error for https://www.google.com
Bjorn van de Peut
@bjorno43
Jan 18 2018 22:27
Because you're looking up a domain. http(s) isn't part of the domain. Everything else is
Mithu Kurian
@mithukurian
Jan 18 2018 22:27
Can some tell me whats the issue with this code?
image.png
Aditya
@ezioda004
Jan 18 2018 22:28
@mithukurian The dot notation cant be used for strings with whitespace, gotta use bracket
artbohr
@artbohr
Jan 18 2018 22:29
@bjorno43 oh damn, thought you can overcome this with some option or I was doing something wrong, because in the example of the project it says HINT: to be sure that the submitted url points to a valid site you can use the function dns.lookup(host, cb) and the example has the default link set to https://www.freecodecamp.com
Bjorn van de Peut
@bjorno43
Jan 18 2018 22:30
@artbohr Hmm. Odd. I honestly have no idea if that's rly how it works. But it makes sense to me
artbohr
@artbohr
Jan 18 2018 22:31
here is how it's shown: https://url-shortener-mserv.glitch.me/
Mithu Kurian
@mithukurian
Jan 18 2018 22:31
@ezioda004
still showing error
image.png
Aditya
@ezioda004
Jan 18 2018 22:32
I see a dot after inside, remove that
artbohr
@artbohr
Jan 18 2018 22:32
@bjorno43 I guess I gotta sanitize the input then to cut the https:// thanks, just was wishing with a more beautiful solution ^^
CamperBot
@camperbot
Jan 18 2018 22:32
artbohr sends brownie points to @bjorno43 :sparkles: :thumbsup: :sparkles:
:cookie: 200 | @bjorno43 |http://www.freecodecamp.org/bjorno43
artbohr
@artbohr
Jan 18 2018 22:32
wishing for*
Mithu Kurian
@mithukurian
Jan 18 2018 22:32
great!!!!
it worked..
@ezioda004 thank you so much
CamperBot
@camperbot
Jan 18 2018 22:33
mithukurian sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 399 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Bjorn van de Peut
@bjorno43
Jan 18 2018 22:33
@artbohr Well, the example will actually give you the same error. But it's possible to create a more "elegant" solution. Just strip the http(s):// from the string in the backend if it's present
artbohr
@artbohr
Jan 18 2018 22:34
@bjorno43 ye, thats what I'm going to do as I sad before
said*
ty again
Bjorn van de Peut
@bjorno43
Jan 18 2018 22:35
Anyway. Who's interested in joining me into a experimental feature that might be added to FCC in the future?
Nothing is required from you of course. Except visiting a website :)
Mithu Kurian
@mithukurian
Jan 18 2018 22:35
@ezioda004 I am still confused where to put dot or bracket.
Manish Giri
@Manish-Giri
Jan 18 2018 22:36
@mithukurian you can use . whenever the property name exists on the object directly
if it's a variable instead, then you use [ ]
but not both at the same time
Aditya
@ezioda004
Jan 18 2018 22:37
@mithukurian It's easy dots only for String (with no space and no number at the beginning). Brackets for variables and everything else.
Manish Giri
@Manish-Giri
Jan 18 2018 22:38

like

const john = {
name: "John Doe",
age: 20
}

so if you want the value of the name property, you do john.name

and let's say the name property is contained in a variable instead -
const someUnknownVariable = "name",
then you do john[someUnknownVariable ]

Mithu Kurian
@mithukurian
Jan 18 2018 22:42
I got it. Thank you once again @ezioda004 and more especially @Manish-Giri . Well explained.
CamperBot
@camperbot
Jan 18 2018 22:42
mithukurian sends brownie points to @ezioda004 and @manish-giri :sparkles: :thumbsup: :sparkles:
api offline
:star2: 6803 | @manish-giri |http://www.freecodecamp.org/manish-giri
Manish Giri
@Manish-Giri
Jan 18 2018 22:43
:+1:
Aditya
@ezioda004
Jan 18 2018 22:44
var object = {
"hello" : "world",
"4drress" : "123 antartica"
}
So you could do object.hello and object["hello"] and it would return //world but you cant do object.4drress //syntax error if you do object["4drress"] //123 antartica.
artbohr
@artbohr
Jan 18 2018 22:45
any cleaner solution than this?
if (req.body.url.includes("http")) req.body.url = req.body.url.slice(req.body.url.indexOf("://")+3);
to cut the http/https from the url string
Mithu Kurian
@mithukurian
Jan 18 2018 22:45
yes. I get you
@ezioda004
Manish Giri
@Manish-Giri
Jan 18 2018 22:45
you'll need quotes inside [ ]
won't work without it
Aditya
@ezioda004
Jan 18 2018 22:45
Cool mine was scrolled up didnt see @Manish-Giri reply
Manish Giri
@Manish-Giri
Jan 18 2018 22:45
object[4drress] should be object["4drress"]
Mithu Kurian
@mithukurian
Jan 18 2018 22:46
okay great ..
Aditya
@ezioda004
Jan 18 2018 22:46
Correct
Mithu Kurian
@mithukurian
Jan 18 2018 22:46
I was about to ask you this question
Thanks @Manish-Giri
CamperBot
@camperbot
Jan 18 2018 22:46
mithukurian sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
api offline
Mithu Kurian
@mithukurian
Jan 18 2018 22:47
So after object I shouldn't be putting . right instead I should use as you have mentioned @Manish-Giri

like this right ? object["4drress"]

so no . after object

artbohr
@artbohr
Jan 18 2018 22:49
@mithukurian to access a variable, because you can't access a string with dot notation
Mithu Kurian
@mithukurian
Jan 18 2018 22:50
@artbohr okay
artbohr
@artbohr
Jan 18 2018 22:51
@mithukurian try reading @ezioda004 explanation again
or @Manish-Giri explanation above it, they are very good, try to console log it and play with it, you'll get it even better @mithukurian in case you are not sure
Mithu Kurian
@mithukurian
Jan 18 2018 23:01
sure. but how do I console.log in freecodecamp pane
I got it thanks @ @artbohr
CamperBot
@camperbot
Jan 18 2018 23:03
mithukurian sends brownie points to @artbohr :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @artbohr |http://www.freecodecamp.org/artbohr