Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
negyvenketto
@negyvenketto
@mtmorawska and you want to push that
mtmorawska
@mtmorawska
@negyvenketto that must be it!
negyvenketto
@negyvenketto
@mtmorawska also, you might want to review how the push function works
Coryphaeus
@cvdeby
How can I get into match variable matched value?
  function replacer(match) {
    return match; // got '$&'
  }
  "&<>'".replace(/[&<>"']/gi, replacer('$&') );// got "&<>'"
  //but 
  "&<>'".replace(/[&<>"']/gi, '$&'); // got "&<>'"
mtmorawska
@mtmorawska
@negyvenketto I'll check that, and let you know how it went. Thanks so much for your input!
CamperBot
@camperbot
mtmorawska sends brownie points to @negyvenketto :sparkles: :thumbsup: :sparkles:
:warning: mtmorawska already gave negyvenketto points
negyvenketto
@negyvenketto
@mtmorawska yw
kirbyedy
@kirbyedy
@vaspv it should be data.stream
Blauelf
@Blauelf
@cvdeby "&<>'".replace(/[&<>"']/gi, replacer) like this? replacer will be called with a couple of arguments, but the first is the whole match (followed by groups, then I think some start index and the whole string, but that's in the documentation of replace
Coryphaeus
@cvdeby
@Blauelf Thanks)
CamperBot
@camperbot
cvdeby sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 1648 | @blauelf | http://www.freecodecamp.com/blauelf
mtmorawska
@mtmorawska
@negyvenketto it worked!
negyvenketto
@negyvenketto
@mtmorawska :thumbsup:
Coryphaeus
@cvdeby

Thanks to @Chrono79 for dictionary)

var dictionary = {
  '&' : '&amp;',
  '<' : '&lt;',
  '>' : '&gt;',
  '"' : '&quot;',
  "'" : '&apos;'
};
function replacer(match) {
  return dictionary[match];
}
function convertHTML(str) {  return str.replace(/[&<>"']/gi, replacer );
}

Can I make it directly -without dictionary?

CamperBot
@camperbot
cvdeby sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star: 403 | @chrono79 | http://www.freecodecamp.com/chrono79
negyvenketto
@negyvenketto
@cvdeby probably yes, but it wont be so clean/easy to understand
ALMY91
@ALMY91
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


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

if(firstName===contacts[i][firstName]) {

  if(prop===contacts[i][firstName].hasownprop(prop)) {return contacts[i][prop];}
  else {return "No such property";}    }

    else {return "No such contact";}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
whats going on guys
Coryphaeus
@cvdeby
@negyvenketto I'll use &#38; instead, if it'll be needed in real project)
Alessandro Giordo
@bovas85
@ALMY91 hasOwnProperty
you can't use functions with all lowercase
Blauelf
@Blauelf
The name is hasOwnProperty (and has to be written like that, that function returns true or false)
Also, use contacts[i].firstName or contacts[i]["firstName"] (as firstName is not a property name but the value to compare to, but "firstName" is the name)
And fix the indentation (it's not clear at all what belongs where), you might need to remove the else {} around that last return statement.
For fixing indentation (please do something like that before posting), you could use your editor's features or an online service like jsbeautifier.org
V1ad1m1r
@V1ad1m1r
This message was deleted
CamperBot
@camperbot
no wiki entry for: ceasars
V1ad1m1r
@V1ad1m1r
This message was deleted
CamperBot
@camperbot
no wiki entry for: ceasars cipher
V1ad1m1r
@V1ad1m1r
help cipher
CamperBot
@camperbot

:point_right: algorithm caesars cipher [wiki]

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program. :busts_in_silhouette: Write your own code. :memo:

:checkered_flag: Problem Explanation:

  • You need to write a function, which will take string encoded with
    Caesar cipher as a parameter and decode it.
  • The one used here is ROT13 where the value of the letter is
    shifted by 13 places.
    e.g. 'A' ↔ 'N', 'T' ↔ 'G'.
  • You have to shift it back 13 positions, such that 'N' ↔ 'A'.

:pencil: read more about algorithm caesars cipher on the FCC Wiki

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


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

if(firstName===contacts[i][firstName]) {

  if(prop===contacts[i][firstName].hasOwnProp(prop)) {return contacts[i][prop];}
  else {return "No such property";}    }

    else {return "No such contact";}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Alyssa Alvarez
@AlysCole
You'll want to wrap your for loop.
for (var i=0;i< contacts.length ; i++) {
  if(firstName===contacts[i][firstName]) {
    if(prop===contacts[i][firstName].hasOwnProp(prop)) {return contacts[i][prop];}
    else {return "No such property";}    }
  else {return "No such contact";}
}
Blauelf
@Blauelf
@ALMY91 :point_up: 15. April 2016 12:10
ALMY91
@ALMY91
@Blauelf :package:
UDAY PRAPHULLA MALANGAVE
@malangaveuday
$.ajax({
url: 'http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en',
success: function(data){
console.log("success ",data);
},
error: function(data){
console.log("error ",data);
},
type: 'GET'
});
this request providing proper response in postmaster but not in ajax call please guys help me
its shown error
ALMY91
@ALMY91
@Blauelf hehe im doing it for the second time :smile:
UDAY PRAPHULLA MALANGAVE
@malangaveuday
$.ajax({
       url: 'http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en',
       success: function(data){
         console.log("success ",data);
       },
       error: function(data){
         console.log("error ",data);
       },
       type: 'GET'
     });
this request providing proper response in postmaster but not in ajax call please guys help me
its shown error
Alyssa Alvarez
@AlysCole
The error you're receiving is the cross-origin request being blocked?
Ankit Padia
@InsaneSkull
This algorithm Caused me headache . Help me:
function truncateString(str, num) {
   // Clear out that junk in your trunk
   return str.slice(0, num);
 }

  truncateString("A-tisket a-tasket A green and yellow basket", 11);
Alyssa Alvarez
@AlysCole
You'll need javascript to treat the data being received as JSONP
@malangaveuday add the property 'dataType' with the value 'jsonp'.
Ankit Padia
@InsaneSkull
seems like sleeping people here.
ALMY91
@ALMY91
@Blauelf actually i didn really understood what you meant the last time tho
Rujool Doshi
@rujool
@InsaneSkull can u post a link to the challenge here