Skip to content

Instantly share code, notes, and snippets.

@imchao9
Created June 20, 2016 08:55
Show Gist options
  • Select an option

  • Save imchao9/7bae93b020a4ac835ef92c40d426e5f1 to your computer and use it in GitHub Desktop.

Select an option

Save imchao9/7bae93b020a4ac835ef92c40d426e5f1 to your computer and use it in GitHub Desktop.
递归遍历对象属性
function TraversalObject(obj) {
for (var a in obj) {
if (typeof (obj[a]) == "object") {
TraversalObject(obj[a]); //递归遍历
} else {
var RegUrl = new RegExp();
RegUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
if (RegUrl.test(obj[a])) {
fileDownload.push(obj[a]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment