DEV Community

zak100
zak100

Posted on

Comparing strings

var assert = require('assert');
const path = require("path");
const fs = require("fs");
//const F5 = artifacts.require("F5")
//const ST5= artifacts.require("ST5")

module.exports = async function(callback) {
try {
//var ctr =0;
let Str = [];
Str = "fundame"
Str2 = []
for(i=0; i<7;i++){
ch = Str.charAt(i)
Str2[i] = ch
Str2.join("");
console.log(Str2)
if(Str2 == "fundame")
console.log("Found")
else
console.log("Not found")
}

}//try
catch(error) {
console.log(error)
}

callback()
}

[ 'f' ]
Not found
[ 'f', 'u' ]
Not found
[ 'f', 'u', 'n' ]
Not found
[ 'f', 'u', 'n', 'd' ]
Not found
[ 'f', 'u', 'n', 'd', 'a' ]
Not found
[ 'f', 'u', 'n', 'd', 'a', 'm' ]
Not found
[ 'f', 'u', 'n', 'd', 'a', 'm', 'e' ]
Not found

Top comments (0)