This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
// Challenge 2: Validate a palindrome | |
//Return true if palindrome and false if not | |
function isPalindrome(str) | |
{ | |
const revString = str.split('').reverse().join(''); | |
return revString === str; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
// Challenge 1: Reverse a string | |
// Return a string in reverse | |
// ex. reverseString('hello') === 'olleh' | |
function reverseString(str) | |
{ | |
const strArr = str.split(' '); | |
strArray.reverse(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
// Challenge 1: Reverse a string | |
// Return a string in reverse | |
// ex. reverseString('hello') === 'olleh' | |
function reverseString(str) | |
{ | |
const strArr = str.split(' '); | |
strArray.reverse(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
// Challenge 1: Reverse a string | |
// Return a string in reverse | |
// ex. reverseString('hello') === 'olleh' | |
function reverseString(str) | |
{ | |
const strArr = str.split(' '); | |
strArray.reverse(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
//What is the output? | |
var hero = { | |
_name: 'Amin Elhasan', | |
getSecretIdentity: function() | |
{ | |
return this._name; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
//What is the output? | |
console.log(typeof typeof 1); | |
//this returns string | |
</script> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
//What is the ouput of this function | |
var num = 4; | |
function outer() | |
{ | |
var num = 2 | |
function inner() | |
{ | |
num++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
//How to add something to the beginning and end of an array | |
var myArray = ['a','b','c','d']; | |
myArray = ["start", ...myArray] | |
myArray = [...myArray, "end"] | |
myArray = ["start",...myArray, "end"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
//How to add something to the beginning and end of an array | |
var myArray = ['a','b','c','d']; | |
myArray.push("end"); | |
myArray.unshift("start"); | |
console.log(myArray) | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> |