Skip to content

Instantly share code, notes, and snippets.

@michhub-dev
Created May 22, 2020 14:49
Show Gist options
  • Save michhub-dev/209ec0a81cd7c4e16225fdbf383dfa1b to your computer and use it in GitHub Desktop.
Save michhub-dev/209ec0a81cd7c4e16225fdbf383dfa1b to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/lanegil
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var sim = [ "mtn", "glo", "airtel"];
var uppercasedCategories = [];
//explicit iteration
for(var i=0; i<sim.length; i=i+1){
var cash = sim[i];
if( cash !== undefined) {
if(cash.indexOf("last") ===0){
break;
}
uppercasedCategories.push(sim[i].toUpperCase());
}
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">var sim = [ "mtn", "glo", "airtel"];
var uppercasedCategories = [];
//explicit iteration
for(var i=0; i<sim.length; i=i+1){
var cash = sim[i];
if( cash !== undefined) {
if(cash.indexOf("last") ===0){
break;
}
uppercasedCategories.push(sim[i].toUpperCase());
}
}
</script></body>
</html>
var sim = [ "mtn", "glo", "airtel"];
var uppercasedCategories = [];
//explicit iteration
for(var i=0; i<sim.length; i=i+1){
var cash = sim[i];
if( cash !== undefined) {
if(cash.indexOf("last") ===0){
break;
}
uppercasedCategories.push(sim[i].toUpperCase());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment