chore(curriculum): replaced substr with substring (#47801)

replaced substr with substring
This commit is contained in:
Rajat
2022-10-04 02:30:02 +05:30
committed by GitHub
parent fe3acb02ac
commit 74b34ba7f5
6 changed files with 20 additions and 20 deletions

View File

@@ -91,7 +91,7 @@ Your `#navbar` element should contain at least one `a` element whose `href` attr
```js
const links = [...document.querySelectorAll('#navbar a')].filter(
(nav) => (nav?.getAttribute('href') || '').substr(0, 1) === '#'
(nav) => (nav?.getAttribute('href') || '').substring(0, 1) === '#'
);
assert.isAbove(

View File

@@ -79,7 +79,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
assert.isTrue(res.ok);
if(!res.ok) {
@@ -96,7 +96,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
if (res.ok) {
const { _id, username } = await res.json();
@@ -164,7 +164,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substingr(0, 29)
});
if (res.ok) {
const { _id, username } = await res.json();
@@ -198,7 +198,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
if (res.ok) {
const { _id, username } = await res.json();
@@ -237,7 +237,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
if (res.ok) {
const { _id, username } = await res.json();
@@ -276,7 +276,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
if (res.ok) {
const { _id, username } = await res.json();
@@ -319,7 +319,7 @@ async(getUserInput) => {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
})
if(res.ok){
const {_id, username} = await res.json();
@@ -363,7 +363,7 @@ async(getUserInput) => {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
if(res.ok) {
const {_id, username} = await res.json();
@@ -410,7 +410,7 @@ async(getUserInput) => {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `username=fcc_test_${Date.now()}`.substr(0,29)
body: `username=fcc_test_${Date.now()}`.substring(0,29)
});
if(res.ok) {
const {_id, username} = await res.json();
@@ -457,7 +457,7 @@ async(getUserInput) => {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `username=fcc_test_${Date.now()}`.substr(0,29)
body: `username=fcc_test_${Date.now()}`.substring(0,29)
});
if(res.ok) {
const {_id, username} = await res.json();
@@ -504,7 +504,7 @@ async(getUserInput) => {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `username=fcc_test_${Date.now()}`.substr(0,29)
body: `username=fcc_test_${Date.now()}`.substring(0,29)
});
if(res.ok) {
const {_id, username} = await res.json();
@@ -549,7 +549,7 @@ async (getUserInput) => {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
body: `username=fcc_test_${Date.now()}`.substring(0, 29)
});
if (res.ok) {
const { _id, username } = await res.json();

View File

@@ -278,7 +278,7 @@ function largeSum(arr) {
sum = sum.toString(10);
sum = sum.substr(0, 1) + sum.substr(2);
sum = sum.substring(0, 1) + sum.substring(2);
let firstTen = sum.slice(0, 10);
return parseInt(firstTen, 10);

View File

@@ -95,10 +95,10 @@ function isValid(iban) {
iban = __helpers.removeWhiteSpace(iban)
if (!iban.match(/^[\dA-Z]+$/)) return false
var len = iban.length
if (len != ibanLen[iban.substr(0,2)]) return false
iban = iban.substr(4) + iban.substr(0,4)
if (len != ibanLen[iban.substring(0,2)]) return false
iban = iban.substring(4) + iban.substring(0,4)
for (var s='', i=0; i<len; i+=1) s+=parseInt(iban.charAt(i),36)
for (var m=s.substr(0,15)%97, s=s.substr(15); s; s=s.substr(13)) m=(m+s.substr(0,13))%97
for (var m=s.substring(0,15)%97, s=s.substring(15); s; s=s.substring(13)) m=(m+s.substring(0,13))%97
return m == 1
}
```

View File

@@ -84,8 +84,8 @@ function lcs(a, b) {
```js
function lcs(a, b) {
var aSub = a.substr(0, a.length - 1);
var bSub = b.substr(0, b.length - 1);
var aSub = a.substring(0, a.length - 1);
var bSub = b.substring(0, b.length - 1);
if (a.length === 0 || b.length === 0) {
return '';

View File

@@ -91,7 +91,7 @@ Your `#navbar` element should contain at least one `a` element whose `href` attr
```js
const links = [...document.querySelectorAll('#navbar a')].filter(
(nav) => (nav?.getAttribute('href') || '').substr(0, 1) === '#'
(nav) => (nav?.getAttribute('href') || '').substring(0, 1) === '#'
);
assert.isAbove(