Hey everyone! Having trouble understanding what I'm doing wrong with "Profile Lookup". I feel like this should be working, but I can't seem to get any result other than "No such contact" as my return. Am I just overlooking something, or do I have it all wrong?

Well even if I provide a "firstName" match and a "prop" match, it always seems to return "No such contact". That exact code returns "No such Contact" meaning to me that the first "if" statement is returning false for some reason.

@balomus u can access object values using or bracket notation.. or dot notation.. both ways should be goodand u ONLY use dot notation.. whatever follow the dot... its a "real" property/key of that object

@ndburrus, arr is per se an array. Well, is just the references to that array.The array is made in memory, and arr saves the address.So if you "save" the array in another var var myArray = arr you are only saving the address to that array. Besides, if you do this myArr = [arr,item] you are making a new array with two items, in index 0 arr, and in index 1 item.

Hey all, I can't figure out what I'm doing wrong on this Return Largest Numbers in Arrays challenge. It keeps giving me TypeError: Cannot set property '0' of undefined. Should I just paste all of the code?

SEEK AND DESTROYHello campers !! I have been stuck on the Seek and Destroy challenge for a few days... I came up with my own solution that works ...BUT during my research process i've noticed that many had the following solution ..... I do not understand how part of it works and i would greatly appreciate it if some one could clarify ...

functiondestroyer(arr) { args = Array.prototype .slice.call(arguments,1); // Used to convert the arguments object into an array and extract the destroyer arguments... this case 2and3.. this is understood
functionremove(x) { returnargs.indexOf(x) === -1; }
/*
What ido not understand is how the above line of code woks... in my solution i use for loops to iterate through the arrays andfilterfunctiontofilterouttheNulls...
I do not understand how this line of code does the exact same thing in one line... PLEASE EXPLAIN!!!!
*/
return arguments[0].filter(remove);
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);

@devonwilson1, JS doesn't execute anyting in comments, so when you have a text after this // the interpreter skip it even if it'is javascript. Anyway, where is your function? The code you copied hadn't the function checkObj.

i have a question on the "Stand in Line" exercise. A function "queue" is being used to function as a queue. I think the goal is to utilize an array within the function to insert (push) in the last input element (the input elements are "arr" - an array, and "item" - a number). In addition, the first element of the inputted array needs to be removed ("shift"ed). I've tried: a) using an array (within the function "queue"), and b) using "push" & "shift" on the function "queue" itself. Neither method works.

while recursion is not necessarily the best solution in terms of time & space efficiency, it does lead to some elegant solutions ... creating a factorial algorithm is probably one of the easiest & cleanest ways of learning about recursion ...

@morrowr08 you recall the function inside the function but alter it in some way, in this exercise it allows you multiply all the positive integers. it kind of substitutes for a loop for that particular exercise.

the article which helped me with recursion is one I found on the ibm site ... because what i was interested in is not knowing what recursion is (I already knew that) ... but how best to go about coding it ... basically, you start with the end in mind ...

recursion is the technique of calling the same function from within the function, over and over again ... so, the first thing you need to know is: when to stop and return ... so that's the part of the code that needs to be executed first in your recursive function ...

I looked up to research more on it, and came across some code, unfortunately. Completely different from how I was attempting to approach it, I was trying to make an array of numbers decrementing from the number passed into the function. Then take that array and multiply them together.

I keep getting a "-1" value when running this formula: "arr[1].indexOf(secondWord)". I want it to loop through each letter of the second word in an array, but it gives me -1 every time so it isn't finding anything when I know the letter I'm looking for is there, so it should return "true". Any suggestions? Here's my full code block:

Problem Explanation:

The first thing to do is to get familiar with what the program is for, for this I would suggest you check the Wikipedia link as that is very important and from where you can also get the formula for the conversion. The hardest part are finding the formula, implementing it and for some modifying objects by the key. However, something that is not very clear is the fact that your program has to be able to check for any number of objects in the array which is what is tested on the second part.

@unnzowy and your code will not work, because no such contact breaks the loop. to say that no such contact you should have checked for all the entries but your code just checks for one and returns no such contact.

@RifuI yes it does remove non-alphanumeric but not underscore.. in your output it returns something like 0_000. so you have to specify in you regexp to remove underscore.\W is same as [^A-Za-z0-9_] <- see the underscore.

So I'm trying to use file select (or file API) to select file from desktop and send it to an embedded PDF viewer in my HTML Doc. I've tried a lot of different ways with my limited knowledge to push the file from the file-api to the PDFObject and nothing seems to work. I'm not sure if it's not able to do this or if I'm just doing it wrong in many different ways.

Ok, I'm struggling with getting a random quote from an api (still). I'm using $.ajax to use the POST method to request a quote from an api, but it's throwing this error No 'Access-Control-Allow-Origin' header is present on the requested resource. Stackoverflow solutions to this problem all seem to be server-side solutions, not something I can do from my end...did anyone successfully overcome this hurdle?

Problem Explanation:

This task requires us to look at each possible permutation of a string. This is best done using a recursion function. Being able to build a function which collects all permutations of a string is a common interview question, so there is no shortage of tutorials out there on how to do this, in many different code languages.

This task can still be daunting even after watching a tutorial. You will want to send each new use of the function 3 inputs: 1. a new string (or character array) that is being built, 2. a position in your new string that's going to be filled next, and 3. an idea of what characters (more specifically positions) from the original string have yet to be used. The pseudo code will look something like this:

```var str = ???;perm(current position in original string, what's been used in original string, current string build thus far){if(current string is finished) { print current string;}else{ for(var i = 0; i < str.length; i++) {

if(str[i] has not been used) {
put str[i] intothe current position;
mark str[i] as used
perm(current position in original string, what's been used in original string, current string build thus far)
unmark str[i] as used because another branch inthe tree for i + 1 will still likely use it;
}

Problem Explanation:

The first thing to do is to get familiar with what the program is for, for this I would suggest you check the Wikipedia link as that is very important and from where you can also get the formula for the conversion. The hardest part are finding the formula, implementing it and for some modifying objects by the key. However, something that is not very clear is the fact that your program has to be able to check for any number of objects in the array which is what is tested on the second part.

Hi, I need help implementing a way to remove entire duplicates, soarray = [1,1,2,2,3,4,4,5] would turn into array = [3,5], anything with more than 1 copy should be removed. How would I go about this? It's driving me crazy.

@BluesBleu Filter automatically iterates through the array and passes each element to the callback function you provide. If the return value is true (or truthy) the value is put to the result array (new array returned).

Hey guys, I'm working on chapter 209 and it's the counting cards function. Now this is what is presented to me:

var count = 0;

function cc(card) { // Only change code below this line

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

// Add/remove calls to test your function.// Note: Only the last will display

cc(2); cc(3); cc(7); cc('K'); cc('A');

and I have no clue what to do here. This is the task to do:

You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.

Yet I don't know how to even begin. I tried some switch statements and if/else statement but all I've started showed up as wrong. xD

Can someone lend a helping hand or point me in the right direction? Help is greatly appreciated!

You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.

@Alnilam90 For checking I used array of ['K', 'A', '...'] and indexOf property, for another values (card >= 2 && card <=5) is enough. You can use switch or if else expression. But if else works a little bit faster than switch.

@Alnilam90 So, how @CraigBanach said - There are so many ways to do it:smile:

Problem Explanation:

This task requires us to look at each possible permutation of a string. This is best done using a recursion function. Being able to build a function which collects all permutations of a string is a common interview question, so there is no shortage of tutorials out there on how to do this, in many different code languages.

This task can still be daunting even after watching a tutorial. You will want to send each new use of the function 3 inputs: 1. a new string (or character array) that is being built, 2. a position in your new string that's going to be filled next, and 3. an idea of what characters (more specifically positions) from the original string have yet to be used. The pseudo code will look something like this:

```var str = ???;perm(current position in original string, what's been used in original string, current string build thus far){if(current string is finished) { print current string;}else{ for(var i = 0; i < str.length; i++) {

if(str[i] has not been used) {
put str[i] intothe current position;
mark str[i] as used
perm(current position in original string, what's been used in original string, current string build thus far)
unmark str[i] as used because another branch inthe tree for i + 1 will still likely use it;
}

Hi I am doing the wikipedia viewer project and have encountered a strange problem. I'm reusing the code from weather station api and have just put in basic code that displays URL on press of button. The strange this is that it works with weather url but not with a valid wikipedia url

Hi guys! What do you think about using promises in the browser? Im stuck because i want to use async all the time and doesnt know a propoer way to do it . Like in Simon project where i want my User to wait until all answers are displayed...

So let me get this straight. The test1 function does not return 2 because it creates its own personal, local variable named "one", yes? But the second returns two because it accesses the global variable and edits that? Is that correct?

@Prosvia With primitive values that doesn't work, because values are copied to the parameters. As @Aestellar pointed out, with objects it works, because function parameter holds a reference to the object.

You are returning value of property "checkProp", you want to return value of property "gift" or whatever value variable checkProp has. So you have to use bracket notation here to use checkProp as a key for your key-value pairs in myObj.

@laed37 You can use dot notation only if it is a predefined name, and the name follows some rules that also apply to regular variables (starts with letter, $ or _, might also contain numbers in other positions, but for example no spaces). Then, someObj.someProp is equivalent to someObj["someProp"], but very different from someObj[someProp]