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
var brooklynNineNine = { | |
name: 'Amy Santiago', | |
currentRole: 'Detective brooklyn99', | |
husband: 'Jake Peralta', | |
mentor: 'Raymond Holt' | |
} | |
delete brooklynNineNine.mentor; | |
console.log(brooklynNineNine) |
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
var list = | |
{ | |
name: 'Michael Scott', | |
company: 'Dunder Mufflin', | |
designation: 'Regional Manager', | |
show: 'The Office', | |
}, | |
new_obj = { ...list, partner: 'Holly Flax' } |
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
favMovies = ['Begin Again', 'Soul', ['Matrix', 'Matix Reloaded', 'Matrix Revolutions'],['Frozen', 'Frozen 2', ['Tangled', 'Alladin']]] | |
favMovies.toString().split(",") | |
// expected result: ["Begin Again", "Soul", "Matrix", "Matix Reloaded", "Matrix Revolutions", "Frozen", "Frozen 2", "Tangled", "Alladin"] |
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
var numberOfpushUpsToday = 34; | |
if(!isNaN(numberOfpushUpsToday)){ | |
console.log('It is a number') | |
} | |
else { | |
console.log('It is not a number') | |
} |
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
var numberOfpushUpsToday = 34; | |
if(typeof numberOfpushUpsToday === 'number' ){ | |
console.log('It is a number') | |
} | |
else { | |
console.log('It is not a number') | |
} |
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
var numberOfpushUpsToday = 34; | |
if(Number.isFinite(numberOfpushUpsToday) ){ | |
console.log('It is a number') | |
} | |
else { | |
console.log('It is not a number') | |
} |
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
var myHTML= "<div><h1>Jimbo.</h1>\n<p>That's what she said</p></div>"; | |
var strippedHtml = myHTML.replace(/<[^>]+>/g, ''); | |
// Jimbo. | |
// That's what she said | |
console.log(stripedHtml); |
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
function convertToPlain(html){ | |
// Create a new div element | |
var tempDivElement = document.createElement("div"); | |
// Set the HTML content with the given value | |
tempDivElement.innerHTML = html; | |
// Retrieve the text property of the element | |
return tempDivElement.textContent || tempDivElement.innerText || ""; |
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
const { htmlToText } = require('html-to-text'); | |
const text = htmlToText('<div>Nope Its not Ashton Kutcher. It is Kevin Malone. <p>Equally Smart and equally handsome</p></div>', { | |
wordwrap: 130 | |
}); | |
console.log(text); // expected result: | |
// Nope Its not Ashton Kutcher. It is Kevin Malone. | |
// Equally Smart and equally handsome |
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 name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | |
<style> | |
body { | |
display: flex; | |
flex-direction: column; |
OlderNewer