I've been working on SPA (single-page application) with different frameworks, such as AngularJS and DurandalJS. Most of the time, each partial or viewModel needs multiple restful » Yang Zhao on javascript

Question Find the position of the first occurrence of a substring in a string. Returns -1 if the substring is not found. Origin from: Glassdoor Solution » Yang Zhao on leetcode

Regarding to this topic, I have 5 ways to add a file download link/button in HTML. See below: 1. <a> <a href= » Yang Zhao on javascript

This post aims to only list out the most common use of JavaScript Type Conversions: Convert to Boolean: var boolValue = !!x; Convert to String: var stringValue » Yang Zhao on javascript

Following lists 5 common sort algorithms JavaScript implementation. Bubble Sort function bubble_sort(arr) { if (arr.length arr[j + 1]) { var temp = arr[j]; arr[j] » Yang Zhao on leetcode

A problem with ngSrc: The image doesn't reload/change itself if the new/updated image has the same URL as the old image. Solution: Use cache » Yang Zhao on angularjs

Question 2D Matrix(m * n) of positive and negative numbers is given. Matrix is sorted rowwise and columnwise. You have to return the count of -ve » Yang Zhao on leetcode

Question Rotate a one-dimensional array of n elements to the right by k steps. For instance, with n=7 and k=3, the array {a, b, » Yang Zhao on leetcode

Question Given a set S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets » Yang Zhao on leetcode

Question Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 » Yang Zhao on leetcode