Hey all... I'm working on the titleCase bonfire... breaking it down in to smaller parts... I can't see what I've done wrong here... I can split the string in to an array, but my for loop isn't return each new array item... can't figure out why...

@oglavas Object.defineProperty() defines a property on the given object. Not a function. That means, it creates something like a variable (named property) which on assignment (p.foo = something) calls the function you defined with the variable something. Abstract code:

function(input){
this.foo = yourDefinedFunction(input);
}

@johnlovespi myPlants is an array. It holds two objects. Each object has the defined fields "type", and "list".

@oglavas It doesnt say it defines functions. It says it defines properties. You just define the getter and the setter of the property as a function.If you look at how they access the defined property in the example you see:

results should be:Calling new Car(3,1,2) should produce an object with a wheels property of 3, a seats property of 1, and an engines property of 2.Calling new Car(4,4,2) should produce an object with a wheels property of 4, a seats property of 4, and an engines property of 2.Calling new Car(2,6,3) should produce an object with a wheels property of 2, a seats property of 6, and an engines property of 3.myCar should have number values for the wheels, seats, and engines properties.

Hi guys, can anyone explain to me what the this. operator does. I tried using it for a challenge to set a private variable, but it didn't work. So can someone explain to me the differences of the two following lines of code?

@ratishidm in your function setGear you make no use of your parameter change.In myBike.setGear(change) you use a variable change which is not defined anywhere. you have a var mica = new Car() without having defined an Object Car.

@caleb272 In the browsers own console there occurs exactly the error i showed you... google has some workarounds... wait i will take a look

@CraigBanach var name = "hello"; sets a local variable (only usable in current or inner scopes). this.name sets a variable name which sticks to the current object. name = namePassed creates a global variable (usable in all scopes)

@caleb272 Not just web... different kind of things. I'm programming for 7 years now and had an education in it, work and learn myself all time next to school and university and am now doing my bachelor of informatics

@caleb272 Nice to have you in row :D I was just from beginning a bit in web dev and i want to make a bigger project soon whats why i take a closer look. I'm currently interested in graphql requests (Apart from RESTful services), whats where i'm programming at the moment - https://github.com/alpox/graphql-go-gen my current project

@AustinThornley Golang was created by google lately and should make low level programming easier. Its in the row of C and C++, has a garbage collector but stays fast and is made especially for fast compiling.Recently it gets used a lot for web development for programmers which don't like NodeJS because of the javascript syntax, non-type checking and callback style.See Farewell NodeJS

having problems getting the first few test cases to pass, bob.firstname returning undefined and the object key length being 6. not sure how else to set firstname and lastname without calling setfullname which pushes the object key count over 6

@Reza7865 for lack of a better way to describe it, dot notation is "static" in how it works, which is why you can't use a variable name to access a property using dot notation. Whereas bracket notation is an "evaluatable" statement, if I can make up a word

Problem Explanation:

You will create a program that will find the missing letter from a string and add it. If there is not missing letter it will return undefined. There is currently no test case for it missing more than one letter, but if anything recursion can be implemented or a second or more calls to the same function as needed. Also the letters are always provided in order so there is no need to sort them.

Problem Explanation:

You have to create a program that will handle when the register does not have enough cash or will have no cash after the transaction. Other than that it needs to return an array of the change in the form of an array, so that will be a 2D array.

i had been moving through the basic algorithm scripting til i got to the third-last one (seek and destroy) and my head is dizzy trying to solve it. the hint is to use the arguments object and Array.filter(). here's what i have, but obviously i'm grasping wildly at straws here...

@ParagonChuy get the first letter, add 1 to the char code, see if it's the same as the next one, repeat until it does not match, then return the letter you find, return undefined if you run out of letters

@wumpafruits well, to nudge you in the right direction, I'll just say that the point of the exercise is all about private variable, getters and setters. The point is that you can modify a private variable by using methods as opposed to just mutating an object's property directly. Once you kind of wrap you head around that it's probably a lot easier to complete

okay so, since you already have arr, you only need to be able to use the parts of arguments after the first part (index 0). so, make a for loop starting at 1, and push the rest of the arguments into an array that you can use

If compareFunction(a, b) is less than 0, sort a to a lower index than b, i.e. a comes first.

If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. Note: the ECMAscript standard does not guarantee this behaviour, and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.

If compareFunction(a, b) is greater than 0, sort b to a lower index than a.

compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned then the sort order is undefined.

@reacorbett if you're sorting numbers a - b would be ascending, and b - a would be descending

function end(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
return (str.substring(-target.length,target.length) === target);
}
end("Bastian", "n"); I'm getting a false when I'm expecting a true. Any ideas why? I tried this on the console and it worke fine. What am I missing?

@cramjet say you had an array like ["a", "b", 1, 2, 3, 4] and you wanted to just put 2, 3, 4 into a new array. you could loop over the array starting at index 3, and push the remaining parts into an array. that's what you want to do, but with the arguments object, and an index of 1

so my code is picking out a substring from the string str using the substr function. the first parameter of the substr function is the start location and if its negative the substr functions tarts from the end and counts backward. i chose 'target' length. so it goes back by the length of the target string. the second parameter then counts forward and then returns the string of that length.

Hey all... so I just spent the last several hours on the "Title Case a Sentence" and I am happy to say I finally got it to work!! My question is, now that I have completed it is there anywhere to check what the "best" solution would be or at least other solutions?? I don't necessarily want to post it here as it would be a kind of spoiler to others working on it... I am sure that although my code works, it could probably be done better and would like to compare... is there somewhere to do this? Thanks guys.

the first argument is an expression that is going to eval right to left, so literally the interpreter is going to look at your first argument and say "get me the length of n, then turn it into a negative number"

Now you're going to embarrass me ... some of my solutions are an unmitigated mess and badly need to be cleaned up ... but there are a couple of gems in there ... SCM is one ... seek & destroy, perhaps -- but the last time I looked at my comments, I still felt they could be way better ...

@JToddFL -- you're not that far from a solution ... I'm not sure why you weren't able to advance beyond "The" -- cuz I copied your code, output to console.log array[i] and it worked just fine for me ...

@AndreWaroux -- state machines are discussed in some famous compiler books ... and there's all kinds of interesting math around them ... so there are things called finite state automata ... and other weird things .. they are kind of fun ... I wish I knew more about them ... :)

@JToddFL -- are you comfortable with console.log now ?

here's another cool resource for you: http://pythontutor.com/javascript.html ... paste your code in there and you can see, visually, how it runs ... what variables are created, what values they take, etc ...

functionlongest(str){
// iterate over each word in the string// if the current word is longer than the longest word// set the current word to be the longest word
};

We start out with this, which is a perfectly cromulent place to start. We now need to parse our logic and make sure it's sound. We know that iterate means loop, and you very cleverly took care of splitting the array into words, so I'll update our code.

functionlongest(str){
var words = str.split(' ');
// iterate over each word in the stringfor (var i = 0; i < words.length; i += 1) {
// if the current word is longer than the longest word// set the current word to be the longest word
}
};

Look at what we've got now... what's left? We know we're going to have to keep track of the longest string, so that's another variable we'll have to create. Let's update again

functionlongest(str){
var words = str.split(' ');
var longest = '';
// iterate over each word in the stringfor (var i = 0; i < words.length; i += 1) {
// if the current word is longer than the longest word// set the current word to be the longest word
}
};

Now finally we can see that we need to use some logic to filter out the longest word. A simple if statement should do just fine. Constructing our if statement is easy now that we have our logic is simple english

functionlongest(str){
var words = str.split(' ');
var longest = '';
// iterate over each word in the stringfor (var i = 0; i < words.length; i += 1) {
var currentWord = words[i];
// if the current word is longer than the longest word// set the current word to be the longest word
}
};

@JToddFL look at the pseudo code in the body of that for loop and try to construct your if statement based off of that logic

functionlongest(str){
var words = str.split(' ');
var longest = '';
// iterate over each word in the stringfor (var i = 0; i < words.length; i += 1) {
var currentWord = words[i];
// if the current word is longer than the longest word// set the current word to be the longest word
}
};

my recommendation is to not put actual solutions here in the chat ... but put them into one of the js playgrounds like jsbin jsfiddle repl.it ... and then give people a link to the code ... that way they can see the solution if they want to ... but can also avoid seeing it if they don't want

@JToddFL -- the latest version of javascript -- came out last summer ...

Hi guys, I'm having some trouble getting some data from a JSON request. The link http://quotes.stormconsultancy.co.uk/random.json is valid JSON according to jsonlint.com but when I execute a $.getJSON I get the error: No Access-Control-Allow-Origin header is present on the requested resource. and if I request it as jsonp I get the error Uncaught SyntaxError: Unexpected token : BUT there is the correct data when I click on the link in the console. How can I get that data to be read correctly?

you'll want to use https://gitter.im/FreeCodeCamp/HelpFrontEnd that said, someone else was having problems with that API yesterday, and neither myself nor another (more experienced) person here could figure it out. it doesn't help that the documentation on that API is really poor, so i would probably just recommend using another API.

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

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

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

I've been rocking and rolling on this course as a whole, but this prompt is unfamiliar and it's not registering. Anyone have any tips?

@PattyCreates if the concept of a queue is what's confusing, just think of a line of people. People enter a queue (line) from the back and remove themselves from the front. You want to do the same thing with your data. It's just a way of structuring the data you're working with.

@PattyCreates the prompt is asking you to take an array as your first argument, and an item as your second. In the body of your function you should add the item to the back of your array, and remove the first element of your array.

@tmusimbi The dot notation only works if the property key string is a valid JS identifier and you write the key after the dot. Bracket notation works with keys that can be arbitrary strings, variables, or expressions.

@tmusimbi.checkProp looks for property "checkProp". That is the problem there.

Can anyone point me in the right direction. I've got all of the elements in place to solve the Check for Palindromes bonfire, but there's something missing that won't let it check the === vs !==. Help!

@weslez You have to join the array and the reverse array before comparing. You cannot compare array content with === because arrays are objects. === compares object identity (memory location). You can join the arrays to strings and compare them because strings are primitives.