hi, i used jquery when i create the function for my front-end, now hi start to pass everything on React and i want to use pure JS, so i need to know what i can use indeed the .end() function of Jquery
where you want to use?
$(".slideshow > .card:first")
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo(’.slideshow’)
this is my jquery function, i need end to go on
in js we don’t have the function which is used to exit the function .
But still you can come out of function using
if ( condition ) {
return;
}
The return
exits the function returning undefined
.
The break
statement allows you to exit a loop , not a function. For example:
var i = 0;
while ( i < 10 ) {
i++;
if ( i === 5 ) {
break;
}
}
This also works with the for
and the switch
loops.
Did you look at the documentation for end() to see what it is actually used for?
If you’re just converting the Jquery slideshow into React I don’t think you need to worry about what end() actually does. I would Google some example code for slideshows build in React. If you just want a slideshow and don’t really care about making it yourself you can look for an npm package.