freecodecamp

Alibabacloud.com offers a wide variety of articles about freecodecamp, easily find your freecodecamp information here online.

[Freecodecamp] Solution to HTTP JSON API SERVER passed!

varHTTP = require (' http ') varurl = require (' URL ')) functionParsetime (time) {return{hour:time.getHours (), Minute:time.getMinutes (), Second:time.getSeconds ()} } functionUnixtime (time) {return{unixtime:time.getTime ()}}varServer = Http.createserver (function(req, res) {varParsedurl = Url.parse (Req.url,true) varTime =NewDate (ParsedUrl.query.iso)varresultif(/^\/api\/parsetime/. Test (Req.url)) result=Parsetime (Time)Else if(/^\/api\/unixtime/. Test

FREECODECAMP-JS Basic Section

---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 debris (Freecodecamp Advanced algorithm 8)

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

No repeats please (Freecodecamp Advanced algorithm 6)

heap ' s algorithm to generate a fully arranged array function generate (n) {if (n = = = 1) {Permutations.push (Arr.join (")); } else {for (var i = 0;iN; ++i) {generate (n-1); Swap (n% 2 0:i, n-1); }}} generate (Arr.length); Filter out arrays of non-sequential repeats var filtered= Permutations.filter (function (String){return!string.match (regex); }); Return the number of return filtered.leng

Search and Replace-freecodecamp algorithm topics

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-freecodecamp algorithm topic

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

RX Programming Note: Learning in Freecodecamp

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

Freecodecamp Advanced Algorithm (personal to)

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-freecodecamp algorithm topic

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 Converter-freecodecamp Algorithm Topic

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. Arrays-freecodecamp algorithm Topic

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-freecodecamp-js topic

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

Freecodecamp Study Notes-1

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 Note--js

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

Freecodecamp to filter out two different parts of an array

", 7, "filly"] . the hints given for Arr.slice (NUMBER1,NUMBER2) Extract the number between number1 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 a

Arguments Optional-freecodecamp Algorithm Topics

'){ return a+b; } else{ return undefined; } }; } else{ return undefined; } } else if(arguments.length===2){ if(typeof(arguments[0])==='number' typeof(arguments[1])==='number'){ return arguments[0]+arguments[1]; } else{ return undefined; } }}add(2)(2);4. RELATED LINKS Https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/arguments Https://developer

Spinal Tap case-freecodecamp Algorithm Topic

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-freecodecamp Algorithm Topics

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 Thou-freecodecamp algorithm topics

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-freecodecamp algorithm Topic

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

Total Pages: 2 1 2 Go to: Go

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.