0% found this document useful (0 votes)
17 views7 pages

JavaScript Functions and Array Methods

The document provides a concise overview of JavaScript functions, array methods, and string manipulation techniques. It includes examples of regular and arrow functions, various array operations like concat, map, and reduce, as well as string concatenation methods. The content is aimed at helping users quickly reference JavaScript syntax and functionalities.

Uploaded by

shivakrishna1j92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views7 pages

JavaScript Functions and Array Methods

The document provides a concise overview of JavaScript functions, array methods, and string manipulation techniques. It includes examples of regular and arrow functions, various array operations like concat, map, and reduce, as well as string concatenation methods. The content is aimed at helping users quickly reference JavaScript syntax and functionalities.

Uploaded by

shivakrishna1j92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Q JavaScript

@thecodecrumbs ~$ '
[Link] ~
Q JavaScript

// Regular Function
let myCustomFunction = function() {}

// Arrow Function
let myCustomFunction = () => {}

@thecodecrumbs Q1
[Link]
Q JavaScript

Array Cheat Sheet


[ 'a' , 'b' ] . concat ( [ 'c' ]) //['a','b','c']

[ I a I I 'b' l . join ( [ ' - ' l) //'a-b'

[ ' a ' ' ' b , 'c' ] .slice ( 1 ) //['b', 'c']


'
[ I a I I ,b' 'c' ] .indexOf ( 'b' )
'
[ I a I / ' b' 'b' ] .lastindexOf ( 'b' )
'

[ 1 , 2 , 3 ] .map ( x => x * 2) //[2, 4, 6]

[ 2 , 15 , 3 ] . sort() //[15, 2, 3]

[ 1 , 2 , 3 ] . reverse () //[3, 2, 1]

@thecodecrumbs
[Link]
Q JavaScript

Array Cheat Sheet


[1 , 2 , 3 ] . reduce ( ( x, y ) => x * y)
[1 , 2 , 3 ] .length
[1 , 2 , 3 ] . every ( x => x < 10 ) //true
[1 , 2 , 3 ] .some (x => x < 2) //true

canst arr = [ 1 ' 2 , 3 l


canst x=a rr . shift() //arr=[2, 3 l , x=1
canst x=a rr .unshift( 9) //arr=[9, 1 ' 2, 3 l , x=4
canst x=a rr . pop() //arr=[ 1 ' 2 l , x=3
canst x=arr .push( S) //arr=[1, 2, 3, s l , x=4

@thecodecrumbs
[Link]
Q JavaScript

String Methods
The + Operator
canst str = ' Hello ' + ' ' + ' World '
//Hello World

[Link]( )
[ 'Hello ' , ' ' , ' World' ] .join ( '' )
//Hello World

@thecodecrumbs
[Link]
Q JavaScript

String Methods
[Link]()
canst st r1 = ' Hello '
canst st r2 = str 1 . concat ( ' ' World' )
//Hello World

Template Literals
canst str 1 = ' Hello'
' ${ st r1 } World "
//Hello World

@thecodecrumbs
[Link]
How many do
you know?
@thecodecrumbs
[Link]

You might also like