This file contains hidden or 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
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"ecmaFeatures": { | |
"experimentalObjectRestSpread": true, |
This file contains hidden or 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
// app.js | |
var htmlTarget = document.querySelector("#target"); | |
var resultDiv1 = document.createElement("div"); | |
SprinklrTest.Send(new SprinklrTest.ReviewListRequest({ | |
ItemsPerPage: 5, | |
OneBasedOnPage: 2, | |
Sort: "TimeStampAscending" | |
}), function callback(responseData) { | |
console.log("ima result", responseData) | |
// in the callback function we accept the returned val from request and we pass in a results variable to hold the response |
This file contains hidden or 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 btn = document.querySelector("#post-button"); | |
var btnJquery = $("#post-button"); | |
var target = document.querySelector("#target"); | |
// vanilla javascript | |
btn.addEventListener("click", function(event) { | |
console.log("you clicked the button"); | |
}); |
This file contains hidden or 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
<h1 id="title">Party Time</h1> | |
<button class="button">Change Color</button> | |
<div class="target"></div> |
This file contains hidden or 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
<h1 id="title">Party Time</h1> | |
<button class="button">Change Color</button> | |
<div class="target"></div> |
This file contains hidden or 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
// vanilla javascript | |
var someId = document.getElementById("name-of-div"); // returns one element by id | |
var someId2 = document.querySelector("#name-of-div"); // returns one element using CSS selector syntax | |
// Jquery | |
var someId2 = $("#name-of-div"); // returns one element with new jquery methods using CSS selector syntax | |
// vanilla javascript | |
var someClass = document.getElementsByTagClassName("name-of-class"); // returns an array-like list of elements | |
//Jquery | |
var someClasses = document.querySelectorAll(".name-of-class"); // returns an array-like list of elements |
This file contains hidden or 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Intro JS</title> | |
<!-- Icon libaray--> |
This file contains hidden or 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 foodOrder = ["fries", "shake", "pickles", "polenta", "salad"]; | |
var happyFood = []; | |
//make each food order item print happy | |
// map returns an new array with changed items. | |
happyFood = foodOrder.map(function(item) { | |
return ("Happy-" + item); | |
}); | |
console.log(happyFood) |
This file contains hidden or 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 foodOrder = ["fries", "shake", "pickles", "polenta", "salad"]; | |
//make each food order item print happy | |
foodOrder.forEach(function(item) { | |
console.log("Happy-" + item); | |
}); | |
This file contains hidden or 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 foodOrder = ["fries", "shake", "pickles", "polenta", "salad"]; | |
// for loop | |
// for (index semi-colon; condition semi-colon; iterator) | |
// print out each item | |
for (var i = 0; i < foodOrder.length; i++) { | |
console.log("#",i,"-",foodOrder[i]); |
NewerOlder