-
Notifications
You must be signed in to change notification settings - Fork 14
/
04.ExtraCredit.js
57 lines (35 loc) · 1.43 KB
/
04.ExtraCredit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* * * * * * * * * * * * * * * * * * * * * *
* PALEO JS PT 4: EXTRA CREDIT *
* * * * * * * * * * * * * * * * * * * * * */
// Looking for more useful JavaScript methods to implement? These are
// harder than the ones that came before, but I know you can do it.
/** SPLICE **/
// Modifies an array by removing a number of elements and
// inserting any number of new ones.
// Example Usage:
// var arr = [6, 7, 8, 9];
// arr.splice(2, 1, 14, 16); --> returns [8] and arr is now [6, 7, 14, 16, 9]
var splice = function(array, start, count) {
};
/** SPLIT **/
// The opposite of `join`, returns an array by breaking up a string
// using a separator. The separators are not included in the array.
// Example Usage:
// "hello world".split(" "); --> returns ["hello", "world"]
var split = function(string, separator) {
};
/** MATH.SQRT **/
// How *do* you find the square root of a number if you don't have `Math`?
// Example Usage:
// Math.sqrt(4); --> returns 2
var sqrt = function(number) {
};
/** DATE.PARSE **/
// A little function that takes a date string in a variety of formats and
// returns the number of milliseconds since midnight UTC January 1, 1970.
// Note that while the native version sometimes defaults to your local
// time zone, the paleo version is should always default to UTC.
// Example Usage:
// Date.parse("December 12, 1990"); --> returns 660960000000
var parse = function(date) {
};