FreecodecampHttps://www.freecodecamp.com2016-07-03A few days ago in GitHub browsing, accidentally saw a call Freecodecamp open-source project, go into the site after the website feel a bit of Earth green, a bit like a personal build not reliable. But it unexpectedly has an additional public welfare project, is to help non-profit free programming, looked at a bit like really a little. So with the idea of a try to start the inside of the free programmin
---restore content starts---. Pop () removes the element at the end of the array var removedfrommyarray=myarray.pop () Removes the last element of the MyArray array and assigns it to Removedfrommyarray. Shift removes the first element of the array from Var removedfrommyarray=myarray.shift () and assigns the first elements of the MyArray array to a removedfrommyarray. push () Adds an element at the end of the array. Unshift () Add an element example at the beginning of the array: Myarray.push (["
Map the debrisReturns an array whose contents convert the average elevation of the corresponding element in the original array to its corresponding orbital period.The original array contains the formatted object content, like this {name: ‘name‘, avgAlt: avgAlt} .A formula for calculating orbital periods with orbital heightsA: Half-length axis of the track (m),μ = GMThe value to be evaluated should be the nearest integer, and the orbit is based on the earth.The earth radius is 6367.4447 kilomet
Search and Replace1. Requirements
Performs a find and replace on a sentence with a given argument and returns a new sentence.
The first parameter is the sentence on which to perform the find and replace.
The second argument is the word that will be replaced (the word before it is replaced).
The third parameter is used to replace the second argument (the replaced word).
Preserves the case of the original word when replaced. For example, if you want to replace the word "bo
Title case a sentence (uppercase in the first letter of the word)
Requirements
Make sure that the first letter of each word in the string is capitalized, and the remainder is lowercase.
Connectors like ' the ' and ' of ' are the same.
Ideas
Use. Split ("") to separate sentences into an array of words.
Use the For loop to separate each word in the array with. Split (") into an array of letters, with the first element in the array capitalized, i.e. the
1. 2. Bootstrap Jumbotron PropertiesSuper large screen (Jumbotron). As the name implies, the component can increase the size of the caption and add more margin (margin) to the landing page content. The steps for using the oversized screen (Jumbotron) are as follows:
Create a class . Jumbotron.
In addition to the larger font-weight is reduced to 200px.
3. Bootstrap Container PropertiesContainer: Use the. Container to wrap the content on the page to achieve center alignment. The
Freecodecamp Advanced algorithm address stamp here.Freecodecamp Elementary and intermediate algorithm, basic to a thought can be completed, and advanced algorithm a little trouble, so I will own the solution to write clearly, if there are errors or better solution, welcome message.Validate US Telephone NumbersIf the incoming string is a valid US phone number, it is returned true .In short, the rule of the U.S. number is that the country code (must be
Return largest Numbers in Arrays (Find out the maximum number of multiple arrays)
Requirements
The large array contains 4 decimal groups, each of which finds the maximum value in each decimal group, and then concatenates them together to form a new array.
Ideas
Use the For loop to iterate through the algebraic groups and arr[i] access each element of the array in a way.
In the first layer for loop, define the variable temp as the first element of the subar
Roman numeral Converter1. Requirements
Converts a given number into Roman numerals
All returned Roman numerals should be in uppercase form
2. Ideas
Array of corresponding Roman numerals for single-digit, 10-bit, hundred, thousand, respectively
Use Math.floor () to remove numbers from each bit of the number, and to find the corresponding Roman numerals in the previously defined array.
3. Codefunction convert(num) {var arr1 = [‘‘,‘I‘,‘II‘,‘III‘,‘IV‘,‘V‘,‘VI‘,‘VI
Diff two Arrays (compare two arrays)1. Requirements
Compares two arrays and returns a new array
The elements of the array are two of all unique array elements in a given array. In other words, returns the difference of two arrays.
2. Ideas
Defines a new array variable that joins the two arrays entered with. Concat () to assign to it
Defines a check function that returns all the unique array elements in a given array of two
Filter out the eligible elements of a
Reverse a string (flip string)
Title Requirements:
Convert a string to an array
Flipping the array order with the reverse method of the array
Convert an array to a string
Ideas:
Use. Split (") to convert a string into an array of single letters
Use. Reverse () to invert the array
Concatenate array elements into strings using. Join (')
The code is as follows:
1 function reversestring (str) { 2 // Please write y
arguments to array;Array.prototype.slice.call (arguments);Calculates the factorial of an integerfunction factorialize (num) { if(num==0)return 1; return num*factorialize (num-1);}Remove the number specified in the arrayfunction Destroyer (arr) { var args = array.from (arguments). Slice (1); return arr.filter (function(val) { return ! ) Args.includes (val); });} Deestroyer ([1,2,3,1,2,4,7,8,6],1,2,3);Remove the object containing the second argument from the first argumentfunctionvar key
to number2 in arr to form a new array and return without changing the original array;arr. Filter (Callbackfunction () {}) returns an array of values that are tested by Callbackfunction in Arr, returned as an array;Arr.indexof (item) finds item in ARR, returns the index value corresponding to item, does not find return-1;arr. concat (ARR2 or numbers) merges arr2 or numbers with the original array arr to return the new array. The previous query is heavy, so consider using the previous function he
Arguments Optional
1. Requirements
Create a function that calculates the sum of two parameters. If there is only one argument, a function is returned, and the function requests a parameter and then returns the result of the sum.
If none of the two parameters is a valid number, the undefined is returned.
2. Ideas
Determine the number of input data
The number of data is 1, the data type is judged,
Type is a number: Assign this data to a, return a fun
Spinal Tap case1. Requirements
Converts a string to a spinal case.
Spinal case is all-lowercase-words-joined-by-dashes in this form, that is, connecting all lowercase words with hyphens.
2. Ideas
Use. Replace () and regular expressions to separate lowercase letters and capitals with a space
Again
3. Replace the space with a '-' and finally lowercase.function spinalCase(str) { var regex = /\s+|_+/g; str = str.replace(/([a-z])([A-Z])/g, ‘$1 $2‘); return str.replace(regex,
Falsy Bouncer (filter array false values)
Requirements
Deletes all false values in the array. (in JavaScript, false values are,,,, false null 0 "" , undefined and NaN .) )
Ideas
Use. Filter () to reject false values in an array
Use Boolea to set callback function to encounter true value return
Code
1 function bouncer (arr) { 2 // Please write your code here 3 function Res (val) { 4 return Boolean (val); 5 } 6 return
Where Art Thou1. Requirements
Write a function that iterates through an array of objects (the first parameter) and returns an array of all objects that contain matching property-value pairs (the second argument).
If the returned array contains property-value pairs for the source object, then each property-value pair of this object must exist in the collection object.
2. Ideas
Remove the property of source with Object.keys (source)
Use Object.keys () to iterate thro
Sum all Odd Fibonacci Numbers
1. Requirements
To a positive integer num, returns the sum of the Fibonacci Ponacic numbers less than or equal to Num.
The first few numbers in the Fibonacci sequence are 1, 1, 2, 3, 5, and 8, and each subsequent number is the sum of the first two digits.
It is not possible to implement the Fibonacci sequence with a recursive return. Because memory overflows when NUM is large, it is recommended to use an array to implement it.
2. Ideas
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.