Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
Can anyone help me how I can able to create a session using JavaScript?

1 Answer

0 votes
by (26.7k points)

You can use session storage, which doesn't have an expiry which will look like this:

<script> 

sessionStorage.setItem('lastname','Smith');

alert(sessionStorage.getItem('lastname'));

</script>

I hope this will help.

Want to become a Java Expert? Join Java Certification now!!

Want to know more about Java? Watch this video on Java Tutorial for Beginners | Java Programming :

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jan 25, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...