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
| // Example 4.1: Function Hoisting | |
| function subFunction(){ | |
| return 'foo'; | |
| } | |
| console.log(subFunction()); | |
| function subFunction(){ | |
| return 'baz'; |
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
| // Example 4.2: Function Hoisting | |
| function comboFunction(){ | |
| function subFunction(){ | |
| console.log('foo'); | |
| } | |
| return subFunction(); | |
| function subFunction(){ | |
| console.log('baz'); | |
| } |
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
| // Example 4.1: | |
| function subFunction(){ | |
| console.log('foo'); | |
| } | |
| console.log(subFunction()); | |
| function subFunction(){ | |
| console.log('baz'); | |
| } |
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
| // Adding variable assignments to Example 4.1 | |
| // to create function expressions | |
| var x = function (){ | |
| return 'foo'; | |
| } | |
| console.log(x()); | |
| x = function (){ | |
| return 'baz'; |
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
| // Configure the list animations on single project views | |
| var galleries = $('.carousel-gallery'); | |
| var carousels = $('.carousel'); | |
| $.each(galleries, function(){ | |
| var that = $(this); | |
| var subGalleries = that.find('li'); | |
| var numSubGalleries = subGalleries.length; | |
| that.attr('data-index', numSubGalleries); | |
| }) |
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 foo, | |
| a = 1, | |
| b = 2; | |
| foo = a === b ? 'Matches' : 'Does not match'; | |
| console.log(foo); // 'Does not match' |
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 $myCarousel = $('#myCarousel'); | |
| if($myCarousel){ | |
| console.log('Carousel Exists'); | |
| } else { | |
| console.log('Carousel Does Not Exist Yet'); | |
| } | |
| // 'Carousel Exists' |
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 myCarousel = document.getElementById('myCarousel'); | |
| if(myCarousel) { | |
| console.log('Carousel Exists'); | |
| } else { | |
| console.log('Carousel Does Not Exist'); | |
| } | |
| // 'Carousel Does Not Exist' |
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
| const ADD_PROJECTS = "projects/add_projects" | |
| const initialState = { | |
| projects: [] | |
| } | |
| export default function reducer(state = initialState, action = {}){ | |
| switch(action.type){ | |
| case ADD_PROJECTS: | |
| return { |
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
| const ADD_PROJECTS = "projects/add_projects" | |
| const initialState = { | |
| projects: [] | |
| } | |
| function reducer(state = initialState, action = {}){ | |
| switch(action.type){ | |
| case ADD_PROJECTS: | |