get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
Hello guys, I got stuck. Any idea why it's not working?
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/import-a-default-export
"use strict";
import add from "./math_functions";
subtract(7,4);
add
not subtract
In the following code, please import the default export, subtract, from the file "math_functions", found in the same directory as this file.
let arr = [5,4,3,2,1];
function reverse(arr){
let temp = [];
for(let i = 0; i < arr.length; i++){
temp.splice(0, 0, arr[i]);
}
arr = temp;
return arr;
}
console.log(reverse(arr)); // [1,2,3,4,5]
splice()
allowes me to set the position of where I want to push something into an array. The rest is easy :) @coderkarma
pop()
for it. That removes the last value of an array and returns it. In that case all you had to do was use that value and push it into the temp array.
it looks like you have not completed the necessary steps. Please complete the required challenges to claim the Responsive Web Design
var person = {
fullName: function() {
return this.firstName + " " + this.lastName;
}
}
var person1 = {
firstName:"John",
lastName: "Doe",
}
var person2 = {
firstName:"Mary",
lastName: "Doe",
}
person.fullName.call(person1); // Will return "John Doe”
The difference between call() and apply()
The call() method takes arguments separately.
The apply() method takes arguments as an array.
var arr = [6, 89, 3, 45];
var maximus = Math.max.apply(null, arr); // returns 89
res.json({key:value})
?
if nothing else seems a good idea
/[^\?]*/i
? match 0 or more but not ?
?
?
"www.somewebsite.com/?prefn1".match(/(^.+)\?/)[1] // "www.somewebsite.com/"
[1]
for?
i
flag threw it off.
Hey guys i am at a complete loss on how to solve this exerciser below.
Basic JavaScript: Use the parseInt Function: "Use parseInt() in the convertToInteger function so it converts the input string str into an integer, and returns it."
function convertToInteger(str) {
}
convertToInteger("56");
if you look at the lesson instructions:
The parseInt() function parses a string and returns an integer. Here's an example:
var a = parseInt("007");
str
function convertToInteger(str) {
var a = parseInt("100", 10);
}
convertToInteger("56");
return (56);
with mongodb you can use a combination of capped collections and tailable cursors to make kind of event listeners
After clients insert new additional documents into a capped collection, the tailable cursor will continue to retrieve documents.
"100"
from?
parseInt(stringToBeParsed)
in this case, the string is stored in the str
variable
str
) and spit out an integer
function convertToInteger(str) {
// do magic to turn the string into an integer using parseInt()
// return the integer
}
convertToInteger("56");
///
function convertToInteger(str) {
var str = parseInt();
return (str);
}
convertToInteger("56");
///
str
is already defined in the function definition function convertToInteger(str)
str
to parseInt()
function printManyTimes(str) {
"use strict";
// change code below this line
const sentence = str + " is cool!";
for(let i = 0; i < str.length; i+=2) {
console.log(sentence);
}
// change code above this line
}
printManyTimes("freeCodeCamp");
//this is the result of the test... why?
SENTENCE
isn't the same as sentence
, the instructions ask you to use all-caps
@thekholm80 perfect that worked!! Thanks man!
P.S. how do you add code correctly on here
\\
function convertToInteger(str) {
var a = parseInt(str);
return a;
}
convertToInteger("56");
\\
\\
function convertToInteger(str) {
var a = parseInt(str);
return a;
}
convertToInteger("56");
\\
ahh haha
`
function convertToInteger(str) {
var a = parseInt(str);
return a;
}
convertToInteger("56");
`
function convertToInteger(str) {
var a = parseInt(str);
return a;
}
convertToInteger("56");
```
function convertToInteger(str) {
return parseInt(str);
}
const convertToInteger = str => parseInt(str);